Solved

Feature Writer to Feature Reader

  • 13 July 2016
  • 8 replies
  • 10 views

Badge

Hello: I read features into a Feature Writer to write into an Macro Enabled Excel document (Sheet 1) and use Feature Reader to read from Sheet 3 from the same Macro Enabled Excel document (where I write into an Excel document a single feature that meets a set of specified conditions). From my observations, it appears as though the Feature Reader goes back and reads the Excel document from before it was changed (from the Feature Writer) irrespective the number of times I run the model. May I ask if anyone attempted anything comparable to what I have in the workflow shown below? If so, did you experience comparable difficulties? How did you resolve these difficulties?

icon

Best answer by mark2catsafe 14 July 2016, 18:03

View original

8 replies

Badge

I'll clarify ... I read from Sheet 3; the values in Sheet 3 should change every time I change the values for the tester (and, subsequently, the values I write to Sheet 1) because the values I have in Sheet 3 are, in essence, calculations I perform on those values I input into Sheet 1 through the writer.

Badge

I guess you are using Excel's function to update the value in sheet3. If that is the case, with a Feature Writer to write Excel, immediately with the Feature Reader to read, don't read the updated value, because Excel is the default when opening the workbook to update the value, after all you can write to Excel, using VBScript(Or you can also use other methods) open the Excel file and then save?close it. So again through the Feature Reader to read Excel file, you will find that can get the updated value.

20160714-featurewritereadtester.fmwt

I suppose it might be possible that the FeatureWriter outputs the summary before it has closed the writer. As a quick fix I'd try putting either a Decelerator transformer or FeatureHolder transformer between the FeatureWriter/Reader, just to give a little pause to the translation.

I suppose it might be possible that the FeatureWriter outputs the summary before it has closed the writer. As a quick fix I'd try putting either a Decelerator transformer or FeatureHolder transformer between the FeatureWriter/Reader, just to give a little pause to the translation.

Having said that, I just tried this and the same issue didn't happen for me. Mine didn't have macros in it though.

So... can you disable the FeatureReader and run the workspace. Then inspect the written data in the Data Inspector. Does it show the updates? I'm thinking more that the FeatureWriter isn't writing the data more than the FeatureReader is going back to a prior version.

Badge

I suppose it might be possible that the FeatureWriter outputs the summary before it has closed the writer. As a quick fix I'd try putting either a Decelerator transformer or FeatureHolder transformer between the FeatureWriter/Reader, just to give a little pause to the translation.

Hi @mark2catsafe: I am able to write to the specified sheet in the Excel document (e.g. Sheet1). In theory, because of the cell references to Sheet1 in Sheet2, I should be able to extract the values in Sheet2 based on the changes made to Sheet1 without a problem.

Having run the model, the values in both Sheet1 and Sheet2 change (as per the values I input into the Tester - the Feature Writer changes the values in Sheet1 based on the Tester and the values in Sheet2 change as per the reference to the values in Sheet1). The only instance where the values change in the Inspector is when I go directly into the Excel document, exit out of the document and save it as I'm exiting out before running the actual model. I'm not sure what the problem could be in this instance.

Badge

I suppose it might be possible that the FeatureWriter outputs the summary before it has closed the writer. As a quick fix I'd try putting either a Decelerator transformer or FeatureHolder transformer between the FeatureWriter/Reader, just to give a little pause to the translation.

Hi @mark2catsafe: May I ask that you attach a copy of the FME and its associated data that you used to model the workflow to test for functionality?

 

Badge +3

taojunabc is right i think.

To have excel update the data yuo need to activate the sheet.

Wich can only be doen by opening and closing it with the excell aplication.

So the system, tcl,pythoncaller.

I use a scheme like that to read colours and after processing set the colours back to relevant cells. (VBA scripts in personal.xlsm) It requires me to open the relevant sheets.

I suppose it might be possible that the FeatureWriter outputs the summary before it has closed the writer. As a quick fix I'd try putting either a Decelerator transformer or FeatureHolder transformer between the FeatureWriter/Reader, just to give a little pause to the translation.

Right, when I add linked cells - as you have - then I get the same issue. I've filed it with the developers as PR#71199 and we will see what they say.

However! I am going on vacation for a couple of weeks. So I suggest you also file a case with our support team (safe.com/support) and that way you will be kept up to date with the developer's response. Be sure to tell the support team the PR number so they know what it refers to.

Sorry I couldn't find a solution.

Reply