Solved

Looping in a URL

  • 19 January 2023
  • 3 replies
  • 9 views

Badge +9

Hi All

 

I have a URL in the format http://blah.com/images/{index] where the maximum index value will be the total number of records minus 1. So for three images the indexes would be 0, 1, 2

What is the best way to take the attribute imagecount and loop to the URL for the correct number of times starting at zero???

 

Just getting a bit confused now....

Regards

 

icon

Best answer by ebygomm 19 January 2023, 16:23

View original

3 replies

Userlevel 4

This is often referred to as "pagination" and you can find a pretty good tutorial here:

https://community.safe.com/s/article/Getting-Started-with-API-Pagination

 

Userlevel 1
Badge +10

If you know the image count before the call, you can clone to that number (3), this will then assign a copy number (0,1,2) to each feature and you can use that attribute to formulate the url and then send three requests that way rather than looping.

 

I'd only use looping where a value from the previous call was required for the next call

Badge +9

If you know the image count before the call, you can clone to that number (3), this will then assign a copy number (0,1,2) to each feature and you can use that attribute to formulate the url and then send three requests that way rather than looping.

 

I'd only use looping where a value from the previous call was required for the next call

Thanks very much, that worked fine....all this time with FME and still learning!!!

Reply