Completed

Looping is failing to count properly with if/else statement

I was running my script in a loop with "if" statement and looks like if loop goes over 9 with "if" statement in the middle (if var > 3) it starts treating numbers from 1 again. I already created a ticket awhile back with similar issue but now looks like it is back. Please, use script below in your test case and monitor "if" statement boolean value. It is "false" until it var < 3 which is correct, then it is "true" till var=9 and then it is "false" when var>9 which is an issue because 10 is bigger than 3. Anyone else experiencing same problem?

Just copy/paste it in your advanced view to run.

{
"steps" : [
{
"command" : "LOOP",
"args" : {
"variableName" : "test",
"from" : "1",
"to" : "15",
"increment" : "1"
}
},
{
"command" : "PRINT",
"args" : {
"message" : "@test"
}
},
{
"command" : "IF",
"args" : {
"operator" : "GREATER",
"comparisonType" : "TEXT",
"caseSensitive" : false,
"leftValue" : "@test",
"rightValue" : "3"
}
},
{
"command" : "END_IF",
"args" : { }
},
{
"command" : "LOOP_END",
"args" : { }
}
]
}

0
2 comments
Avatar
Vitaly Melnik

Sorry for confusion. I figured it out. In the "if" statement i forgot to change "Comparison type" to "number". Leaving this here anyway if someone else will experience same issue.

 

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Vitaly,

No problem, we are glad it is working now.

Thank you for using Subject7.

Regards,

Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.