Hi. I am using loop to fill form from csv. Is there any way i can run another action after running 5-10 loops and then resume the loop again.
1 Like
Initialise variable say Counter to 0
start loop
Steps
increment Counter by 1
if count == 5
do the action
reset counter to 0
end
end loop
but i need to run 100 loop. how can i do the action random.
You can add your action code between Line 4 & 5
{
"Command": "store",
"Target": "0",
"Value": "Counter",
"Description": ""
},
{
"Command": "times",
"Target": "100",
"Value": "",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number(${Counter}) + 1;",
"Value": "Counter",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${Counter} == 5",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "Counter",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
1 Like
If you need a randomizer use “ExecuteScript” use the JavaScript random feature to generated anything that is random. You can assign that result back to a local Kantu variable and use it as a counter for a loop. I would also use “Times” feature in Kantu over the loop a as it is shown by uisuer
1 Like
thank you. i will try to use this code
Thank you. i create random number by javascript. maybe not the best solution but maybe it’s the best method i can think of
{
"Command": "executeScript",
"Target": "return Math.floor((Math.random() * 5) + 5);",
"Value": "RandomNumber",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "Counter",
"Description": ""
},
{
"Command": "times",
"Target": "100",
"Value": "",
"Description": ""
},
{
"Command": "executeScript_Sandbox",
"Target": "return Number(${Counter}) + 1;",
"Value": "Counter",
"Description": ""
},
{
"Command": "if_v2",
"Target": "${Counter} == ${RandomNumber}",
"Value": "",
"Description": ""
},
{
"Command": "store",
"Target": "0",
"Value": "Counter",
"Description": ""
},
{
"Command": "executeScript",
"Target": "return Math.floor((Math.random() * 5) + 5);",
"Value": "RandomNumber",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
},
{
"Command": "end",
"Target": "",
"Value": "",
"Description": ""
}
1 Like