loop through tOracleInput and tFileFetch

One Star

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
One Star

Re: loop through tOracleInput and tFileFetch

Hi
tOracleInput--main(row1)-->tFlowToIterate--Iterate-->tFileFetch
Type row1.URI in tFileFetch.
Regards,
Pedro
One Star

Re: loop through tOracleInput and tFileFetch

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
One Star

Re: loop through tOracleInput and tFileFetch

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
Seven Stars

Re: loop through tOracleInput and tFileFetch

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");
One Star

Re: loop through tOracleInput and tFileFetch

The job doesn't execute and I get a message that latitude and longitude cannot be resolved or is not a field.
One Star

Re: loop through tOracleInput and tFileFetch

I get the error as well when I try to use tJava to see the results of the variables.
One Star

Re: loop through tOracleInput and tFileFetch

I figured it out. I was using context.latitude/longitude instead of row1.
One Star

Re: loop through tOracleInput and tFileFetch

Hi
Thanks for your feedback!
Regards,
Pedro