do while loop is not working in flow designe

JayS56800927307
Tera Expert

Hello Guys,

 

I have used the below code in the flow designer for the print logs. but it is running only for the one times in flow designer. 

 

var loop count=0;
var i= 0;
do {
loop_count=loop_count+1;
console.log(num);
i++;
}
while (i < 5);

 

output: 1,2,3,4,5

 

here loop count is integer .it is running only one time only.

 

i have added add operation over here one loop_count  but not getting output 1,2,3,4,5 system log. please help

jay97_1-1669342656834.png

jay97_2-1669342721855.png

 

 

 

 

2 ACCEPTED SOLUTIONS

newhand
Mega Sage

@JayS56800927307 

 

>>it is running only one time only.

YES,because you writed [less than 5] at the [until] part ....

The first time you run the loop...the  [loop_count] becomes 1  ,and it  is  [less than 5]  ,so the loop is ended.

 

you need to change [less than 5] to [more than 5]...

 

 

View solution in original post

As per the image you provided earlier, your flow variable's backend name is not loop_count. See the below image which you provided.

MuhammadKhan_0-1669356657489.png

 

So, in your script, use the proper backend name of your flow variable. In my case it was loop_count.

MuhammadKhan_1-1669356738321.png

 

return fd_data.flow_var.<backend_name_of_your_flow_variable> + 1;

 

 

View solution in original post

10 REPLIES 10