Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
cmalengrez
Contributor II
Contributor II

How can I loop into hashmap of dates and provide this as query parameters to tRestClient ?

Hi,

I'm new to Talend so sorry for eventual 'simple' questions.

I use Talend Open Studio For Data Integration version 7.3.1.

What I need to do is the following :

I receive a java HashMap of dates (begin date, end date) from a custom java routine.

I then need to use this list of pair of dates as query parameters of a tRestClient component to call an api and retrieve the restults via tExtractJsonFields components.

My question is :

How can I loop into the values of the hashmap of dates retrieved from the custom java routine and provide this to the tRestClient query parameters ?

Do i need to write custom java code to loop into the hashmap of dates ? How can I link this to the call of the tRestClient for each iteration of pair of dates ?

Thanks in advance for your help.

Labels (3)
1 Reply
gjeremy1617088143

Hi you can use a tJavaFlex component to loop from your hashmap with a foreach clause and after you can use a tflowtoIterate to iterate on each value from the tJavaflex(tFlowToIterate also store the curent value of the iteration in globalMap so you can use it to set you rest call for each iteration).

https://www.talendbyexample.com/talend-tjavaflex-component-reference.html

https://help.talend.com/r/vn0o8XYVXXNgJkRtWjet9A/gQW7IzhQK0pr5oLxZWT_NQ

Send me love and kudos