Question

Using variable in a where clause


Just getting to grips with FME, what I'm trying to do is use the where clause in reader to limit the reader to only return records after the last OID of the previous process. Probably simple but I'm struggling a bit


2 replies

Userlevel 2
Badge +16

One way to do this is:

Create a user parameter (in the Navigator window): LAST_OID.

That parameter will be prompting for a value if you use the Prompt and Run option.

Then the WHERE in the reader will be:

OID > $(LAST_OID)

 

Another (and maybe better option if you are writing to a database table) option is:

Use a SQLCreator transformer with SQL statement: Select max(OID) as maxoid from <table>

Then use the maxoid in a WHERE clause in the FeatureReader (a transformer that acts as a reader), but then with: OID > @Value(maxoid)

 

I prefer the second option, because it eliminates the manual entry of the last OID.

Hope this helps.

Badge +3

You could use a Sorter + Sampler to send a single Initiator Feature with the Last OID previoulsy read to FeatureReader to do this:

Reply