Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
nam
Former Employee
Former Employee

Retrieving data from a web file using a URL

Hi im doing a simple loop which should increment the pages in a url and give me a resultant output concatenating the results of the loop.

if I change the page number 1 at a time I can see that there is a value for each page.

when I run the loop I can see it increments through the 10 pages, however the result is just 1 line for 1 page.

loop below:

for i=0 to 10

LET $(vPage) =$(i);


summaryTable:
LOAD total_rows,
index,
PageNumber,
summaryKey  
FROM [http://test.test-api.com/testing/api/sometable.php?appid=testappid&token=someToken&page=$(vPage)]
(
XmlSimple, Table is [sometable/summary]);


Next ;

am i doing something obviously wrong here?, any pointers will be welcome

1 Solution

Accepted Solutions
Not applicable


Ah right sorry, change

LET $(vPage) =$(i);
to LET vPage = $(i);

and give that a try, by expanding the variable like that, it's like you are saying

Let 1 = x

and not actually changing your vPage variable and looping the same page 10 times

Joe

View solution in original post

7 Replies
Not applicable

looks fine, and as you say is iterating through the 10 pages. When you hardcoded in page1 did you return more than a single row?

Joe

nam
Former Employee
Former Employee
Author

if I hard code page 1 I get 1 row with the page number showing page 1 and so on for the other pages.

the  loop only returns the last page  its almost like it does not append to the first 1-9 pages..

Not applicable


Ah right sorry, change

LET $(vPage) =$(i);
to LET vPage = $(i);

and give that a try, by expanding the variable like that, it's like you are saying

Let 1 = x

and not actually changing your vPage variable and looping the same page 10 times

Joe

nam
Former Employee
Former Employee
Author

Joe Simmons

Spot on. I overlooked that

Not applicable

No worries let me know if that resolves the issue when you re-run

nam
Former Employee
Former Employee
Author

That works perfect.

Not applicable

perfect, can you mark and close this one down then if possible, cheers