Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Here's the details to the Talend Job. I'm getting an ID from tDBInput to call an API with that ID and then I'll update the same table. When I call the API, I get a new ID and I need to call the same API with that new ID. This is a continuous loop until the API response is null. How do I do that?
tDBInput > tFlowtoIterate > tRestClient > tExtractJSONFields > tMap > tDBOutput
Is there a way to add if tExtractJSONFields is not Null then execute the job again?
@Edith Murillo , If you want to loop you need to follow the way.
1) in job maintain a loop variable as a context variable and data type for that is boolean
2) In staring your job , tDBInput should be connected from tLoop with while loop and values should be like
int i=0
context.val
i++
3) pass the response filed to in tMap in second output section and connect to tjavarow and put the enable or disable filter condition in second output section and check for response not null then from tjavarow take run if and connect to tjava and in tjava set context.val=true;
in the run if of tjavarow to tjava use ((Integer)globalMap.get("tSystem_1_EXIT_VALUE"))>0 condition check
Thanks @Manohar B for your help. I setup the job as you indicated and when the response is null, I'm getting error "Exception in component tJavaRow_1 (name of job) java.lang.NullPointerException". This is the output from the tMap.
In tMap, I have as the enable/disable expression filter row4.entity_id !=null || row4.entity_id != " ". Below is a screenshot of the API response. Any idea how to fix this? Also, do I need to add coding for tJavaRow?
@Edith Murillo , what code have you used in tJavaRow, you will get null pointer exception that when you have not handled null validation.
Hello @Manohar B, I don't have any code for tJavaRow. I have row4.entity_id !=null || row4.entity_id != " " in the filter of the tMap for the tJavaRow output. Why are null rows hitting the tJavaRow? I don't have any code for tJavaRow. How do I handle null validation?