08-09-2013 12:55 PM - edited 03-14-2019 12:13 PM
Does UCCX 8.5 supports while or for loop, if it does then some one can please share syntax of it. Thanks
Solved! Go to Solution.
08-09-2013 06:13 PM
Yes is does. In fact, you can type any Java code you want into the editor, you just have to know how to include it. So for example, if you wanted to loop 10 times, adding each number to the next, and store the output in an int variable:
Do {
int i;
for (i = 1; i <= 10; i++) {
my_num = my_num + i;
}
}
This assumes you have a variable called my_num. You can use Java blocks anywhere in your script where the expression editor exists.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
08-09-2013 06:13 PM
Yes is does. In fact, you can type any Java code you want into the editor, you just have to know how to include it. So for example, if you wanted to loop 10 times, adding each number to the next, and store the output in an int variable:
Do {
int i;
for (i = 1; i <= 10; i++) {
my_num = my_num + i;
}
}
This assumes you have a variable called my_num. You can use Java blocks anywhere in your script where the expression editor exists.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
08-10-2013 11:42 AM
Thanks Anthony.. it worked..
Out of curiosity, in Java we can define variable in for loop, like
for(int i=0; i<10; i++)
but here, it was not allowing me, i had to first create int variable and then call that variable in for loop, like you mentioned above, why is it not allowing me to create variable inside for loop?
08-11-2013 09:40 PM
I don't know, but that's exactly why I wrote it that way. There's some differences between pure Java and UCCX.
Anthony Holloway
Please use the star ratings to help drive great content to the top of searches.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: