Skip to main content
Question

Using variable in a where clause

  • May 6, 2020
  • 2 replies
  • 332 views

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

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

erik_jan
Contributor
Forum|alt.badge.img+26
  • Contributor
  • May 6, 2020

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.


bwn
Evangelist
Forum|alt.badge.img+26
  • Evangelist
  • May 7, 2020

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