Page 1 of 1
Branch to action block for each list element
Posted: 23 Nov 2019 06:41
by jassing
Suppose you have a list of phone numbers.
You want to send an sms msg only to numbers that have "55" in it...
How do I branch to an action block for each list element?
for ( number in numberlist ) {
if( contains(number, "55") ) {
// how to branch out to "Send SMS" action?
}
}
Thanks!
Re: Branch to action block for each list element
Posted: 23 Nov 2019 06:58
by Desmanto
If you use for() loop, you can't. You must use while() or other if() version.
In this case, you don't have to break out the loop to the send SMS. You simply add all number which have "55" to a new list and then loop SMS to all the number.
Code: Select all
sendnum = newList();
for(number in numberlist)
{
if(contains(number, "55")
addElement(sendnum, number)
}
{sendnum} now contains all the number those have "55".
To loop send SMS to all of this, you can use action Send SMS + condition expression. Add a new line script in previous script
At the action send SMS, use {sendnum[index]} as the number. Then next is expression
Code: Select all
index = index + 1;
index > length(sendnum);
false, loop back to Send SMS. This will now tell send SMS to send to the second number (and so on until finish). True, do nothing, essentially stopping the loop/flow.
Re: Branch to action block for each list element
Posted: 24 Nov 2019 03:23
by jassing
Thanks. I started down that road, but thought there might be a better way.
Thanks! I appreciate the detailed response.