Skip to main content
Solved

Looping in a URL

  • January 19, 2023
  • 3 replies
  • 104 views

ingalla
Contributor
Forum|alt.badge.img+10

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

 

Best answer by ebygomm

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

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.

3 replies

david_r
Celebrity
  • January 19, 2023

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

 


ebygomm
Influencer
Forum|alt.badge.img+46
  • Influencer
  • Best Answer
  • January 19, 2023

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


ingalla
Contributor
Forum|alt.badge.img+10
  • Author
  • Contributor
  • January 20, 2023

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!!!