Details
-
Bug
-
Status: Open
-
Medium
-
Resolution: Unresolved
-
None
-
None
Description
Description
Javascript isn't working when using nested conditions with loops
Javascripts with if or for work as expected, but when nesting an if inside a for or a for inside an if it isn't processed anymore.
How to reproduce
Use the following code as a template
Loop1 (if only works): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);if(arServ.length > 1){strListServ+=' ' +0+'. '+arServ[0];}strListServ.toString();}} Loop2 (for only works): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);for (i in arServ){strListServ+=' ' +i+'. '+arServ[i];}strListServ.toString();}} Loop3 (for with nested if no worky): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);for (i in arServ){if(i<arServ.length){strListServ+=' ' +i+'. '+arServ[i];}}strListServ.toString();}} Loop2 (for inside if no worky): ${%{var strServ = 'text1, text2, text3, text4, text5';var strListServ = '';var arServ = strServ.split(', ');var i;var andIndex = (arServ.length -2);if(arServ.length >1){for (i in arServ){strListServ+=' ' +i+'. '+arServ[i];}}strListServ.toString();}}
Expected result
Every version should be processed