Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Save $650 on Qlik Connect, Dec 1 - 7, our lowest price of the year. Register with code CYBERWEEK: Register
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

loop through tOracleInput and tFileFetch

Hi,
I'm very new to Talend.
I'm trying to create a job reading a tOracleInput returning a bunch of latitudes/longitudes and looping through results executing a tFileFetch to call a URI for each record based on the latitude/longitude to return weather data. I need to put the latitude/longitude into the URI for each record. Is this possible? Are these the right components to use?
Thanks,
Marcie
Labels (2)
8 Replies
Anonymous
Not applicable
Author

Hi
tOracleInput--main(row1)-->tFlowToIterate--Iterate-->tFileFetch
Type row1.URI in tFileFetch.
Regards,
Pedro
Anonymous
Not applicable
Author

Thank you so far. I have set up tOracleInput--main(row1)--tflowIterate--iterate--tfileFetch
I need to build the URI based on what is returned in the tOracleInput so I am doing this
"http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locationsearch?latitude=" +row1.latitude + "longitude=" + row1.longitude + "&token=XuynqsXFIGjQEXIshdoyFizBgrdZdwXO"

however it isn't working using latitude and longitude as variables.
How do I accomplish this?
Thanks,
Marcie
Anonymous
Not applicable
Author

Hi Marcie
Do you get any errors?
If there are two columns "latitude" and "longitude" in tOracleInput, these values should be passed into tFileFetch.
Regards,
Pedro
alevy
Specialist
Specialist

I suggest for testing that you replace the tFileFetch with tJava and print the URI you are trying to construct to the console so you can ensure that it is correct e.g.
System.out.println("http://www.ncdc.noaa.gov/cdo-services/services/datasets/GHCND/locationsearch?latitude=" +row1.latitude + "longitude=" + row1.longitude + "&token=XuynqsXFIGjQEXIshdoyFizBgrdZdwXO");
Anonymous
Not applicable
Author

The job doesn't execute and I get a message that latitude and longitude cannot be resolved or is not a field.
Anonymous
Not applicable
Author

I get the error as well when I try to use tJava to see the results of the variables.
Anonymous
Not applicable
Author

I figured it out. I was using context.latitude/longitude instead of row1.
Anonymous
Not applicable
Author

Hi
Thanks for your feedback!
Regards,
Pedro