PhillipCoronakes | 2017-04-19 02:55:46 UTC | #1
Hi,
I am trying to use the simple OR function, and i must be doing something wrong.
What i have in place is an update data action to append the caller number: Replace(ToString(Call.Ani),"tel:+61","0")
so when it tries to evaluate: Flow.CalledANI != 756690500 or Length(ToString(Flow.CalledANI))>6 it returns true when trying to call from a private or caller ID of 756690500.
if i use the OR it returns a true when evaluating both statements, if i try each statement individually it returns false. I have tried adding () but it still doesn't help.
Any suggestions?
MelissaBailey | 2017-04-19 15:58:43 UTC | #2
Hi Phillip,
The 2nd part of your if Length(ToString(Flow.CalledANI))>6 should evaluate to true if you're calling from 756690500 (which is 9 digits long).
Adding a play audio step to play Call.CalledANI using the Speak each character format could help with debugging.
Ullyot_Jim | 2017-04-19 16:19:23 UTC | #3
Hi Phillip,
I looked at the expression tree generated for your expression by the parser for this:
Flow.CalledANI != 756690500 or Length(ToString(Flow.CalledANI))>6
and didn't see any precedence issues. The or is the last operation that's performed. Here's an ascii representation of what the expression tree looks like under the hood that the parser generates for that expression:
'or' ( logical or of boolean values calculated below)
- '!=' ( not equal operator comparing integers )
| + 'Flow.CalledANI' ( value of Flow.CalledANI variable ) | + '75669050' ( literal integer 75669050 )
- '>' ( greater than operator comparing integers )
- 'Length()' ( Length function call )
| + 'ToString()' ( ToString function call ) | + 'Flow.CalledANI' ( value of Flow.CalledANI variable )
Nothing jumps out as out of the ordinary there. Doing what Melissa suggested above would be a good idea.
Also, have you looked at using the phone number data type? It might be helpful here:
phone number data type
If you had an update data action that assigned ToPhoneNumber(Call.Ani) to say, Flow.AniPhoneNumber then in a decision action you could work with that phone number value which lets you get at various pieces of the phone number easily.
For example: Flow.AniPhoneNumber.isTel would resolve to true if there is a "tel:" scheme set on string supplied to create the phone number. And as you'll see on the help page above there are other properties like dialingCode which could help as well ( i.e. Flow.AniPhoneNumber.dialingCode == "61 )
system | 2017-08-28 19:33:58 UTC | #4
This post was migrated from the old Developer Forum.
ref: 1197