Question

For loop in FME

  • 11 July 2018
  • 2 replies
  • 22 views

Badge +5

I'm accessing an API using FME and trying to fetch records by passing certain ids as a parameter to the API . For example the API is,

https://developers.onemap.sg/commonapi/elastic/omsearch?searchVal=1&returnGeom;=Y&getAddrDetails;=Y

In the above API, I need to keep on increment the value of searchVal=1 from 1 to 100 and then pass each to httpcaller to return the response.

I'm able to do this using python caller and get the response using for loop concept. But, I want to do this without python and use any other transformers which does the trick for me.

Any guidance would be appreciated.

Thanks!


2 replies

Userlevel 4

You can use a looping custom transformer, more information here:

http://docs.safe.com/fme/2018.0/html/FME_Desktop_Documentation/FME_Workbench/Workbench/transformers_custom_looping.htm

There's also a detailed tutorial in the training material:

https://s3.amazonaws.com/gitbook/Desktop-Advanced-2017/DesktopAdvanced3CustomTransformers/3.Exercise6.html

Userlevel 2
Badge +19

I would use a Creator with 100 copies.

With AttributeManager I would create a new attribute: searchval = (@Value(_creation_instance) + 1)

The request would be like this:

https://developers.onemap.sg/commonapi/elastic/omsearch?searchVal=@Value(searchval)&returnGeom;=Y?tAddrDetails=Y

Reply