Skip to main content
Solved

Using FeatureReader after FeatureWriter


scootercat_nl
Contributor
Forum|alt.badge.img+5

I have made a script that writes data to Oracle database, using FeatureWriter.

Before I write data, I use FeatureReader to read number of records.

 

At the end of the script I want to know how many records there are now.

I also use FeatureReader for this.

 

The results are always the same as before and after the transactions.

 

It seems that the 2nd FeatureReader has already started before the transactions have been processed.

 

I have tried with Oracle Reader, 2nd connection parameter, SQLExecutor.

The results are always the same as before and after the transactions.

Also using Triggerer and Decelarator.

 

Something has to happen that the 2nd FeatureReader will 're-read' the table.

 

Anyone has a suggestion ?

 

Thank you in advance !

 

Best answer by ebygomm

scootercat_nl wrote:

ExampleWriteRead 

Maybe my description wasn't very clear. I have made an image for clarification.

Hopefully you can help me further.

 

Thanks for your patience

 

Replace your writer with a featurewriter, choose One per Feature Type for your output ports and then use that output to continue the flow

image

View original
Did this help you find an answer to your question?

6 replies

nielsgerrits
VIP

How do you initiate the second featurereader? It should be initiated by the featurewriters summary feature to make sure it starts after the writing is done.

 

Also, if you have featurecaching on, nothing changes for each run. Try to switch it off.


scootercat_nl
Contributor
Forum|alt.badge.img+5
nielsgerrits wrote:

How do you initiate the second featurereader? It should be initiated by the featurewriters summary feature to make sure it starts after the writing is done.

 

Also, if you have featurecaching on, nothing changes for each run. Try to switch it off.

Hi Niels.

 

featurereader Oracle (count number of records) -> feature reader CSV/ZIP -> AttributeManager (fme_db_operation). Hereafter 2 lines : Route 1. FeatureWriter (Oracle) Route 2. Other Transformers.

 

A little further down the Route 2 I start FeatureReader to read out the number of records.

(after Triggerer and Decelarator)

 

I let the entire process run in the background (via task scheduler). Does cache affect this?

 


nielsgerrits
VIP

I believe fetaurecaching is off in batch mode.

 

But you can't place the reader in route 2 and be sure the reading is done before the writing. The reading need to be done downstream of the FeatureWriter. A trick to be sure the order is correct, is to feed the features from the AttributeManager and the outputfeature to a FeatureHolder, then use a Tester to remove the summary feature from the FeatureWriter from the stream, and do the things you want in route 2.


scootercat_nl
Contributor
Forum|alt.badge.img+5
nielsgerrits wrote:

I believe fetaurecaching is off in batch mode.

 

But you can't place the reader in route 2 and be sure the reading is done before the writing. The reading need to be done downstream of the FeatureWriter. A trick to be sure the order is correct, is to feed the features from the AttributeManager and the outputfeature to a FeatureHolder, then use a Tester to remove the summary feature from the FeatureWriter from the stream, and do the things you want in route 2.

ExampleWriteRead 

Maybe my description wasn't very clear. I have made an image for clarification.

Hopefully you can help me further.

 

Thanks for your patience

 


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • Best Answer
  • June 1, 2023
scootercat_nl wrote:

ExampleWriteRead 

Maybe my description wasn't very clear. I have made an image for clarification.

Hopefully you can help me further.

 

Thanks for your patience

 

Replace your writer with a featurewriter, choose One per Feature Type for your output ports and then use that output to continue the flow

image


scootercat_nl
Contributor
Forum|alt.badge.img+5
scootercat_nl wrote:

ExampleWriteRead 

Maybe my description wasn't very clear. I have made an image for clarification.

Hopefully you can help me further.

 

Thanks for your patience

 

thanks for your comment. Combined with your answer I got results I wanted.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings