Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone!
I has this flux: tloop -> iterateToFlow -> RestClient.
I need execute this flux when there is value in execution.
I need tloop to just execute while it comes back from api, if there is no return I need to stop loop
I try put tjava, but I don't know where to put the component.
This api request has 94 pages, this loop start 1 and stop at 94 based on page records.
Each page brings me 100 'records', if I loop it works fine, but I need it automatically as it will come online on a server using crontab.
Hi
you can use tLoop (While)
for example:
define boolean context or global variable
context.do_iterate = true;
than in tLoop use single condition
context.do_iterate
loop will work infinite until the condition is true
after tExtractJSONFields you can add tJava component and reset variable if data is empty
context.do_iterate = false;
@vapukov wrote:
Hi
you can use tLoop (While)
for example:
define boolean context or global variable
context.do_iterate = true;
than in tLoop use single condition
context.do_iterate
loop will work infinite until the condition is true
after tExtractJSONFields you can add tJava component and reset variable if data is empty
context.do_iterate = false;
Sorry for the delay, but how will check if data is empty?
Can you help about code?
In the meantime I'll try to build something
Hello,
When I set do_iterate = true, the flow are infinity.
The process doesn't continue for next step.
Is it correct do_iterate in condition, because how does the process know to do the rest?
@shong wrote:
Do each API calling will return one page and the page will contain 0 or several records? If it is 0, you want to stop the loop?
Yes, I need this. When 0, it stops.
Change the job design as below:
tLoop--iterate--tJava1--oncomponentok-->RestClient-->tExtractJsonField-->tJavaRow--oncomponentok--tJava2
on tJava1:
context.counter=0;
on tJavarow:
context.counter++;
on tJava2:
if(context.counter==0){
context.do_iterate=false;
}else{
context.do_iterate=true;
}
//Define another context variable called counter, int type.
Please test and let me know if it works.
I trying to use your model, but I have similar problem. Because tloop -> do_iterate = true, does not go to the next step, becomes infinite.
I stopped manual this execution.
Can you upload a screenshot of tRestClient component? I want to see that your each API calling return different response rather than the same response.