Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
tmumaw
Specialist II
Specialist II

Syntax Help

I have a phone number which can be either 13 or 14 positions long and I need to get them into one field called callingpartynumberno. I am doing this during my SQL extract, but getting an error. I need to have the If's due to other phone numbers being 2 or 5 positions. Please help. Thanks

if (len(trim([callingPartyNumber])) = 13,
PurgeChar([callingPartyNumber], Chr(34))),
if (len(trim([callingPartyNumber])) = 14,
PurgeChar([callingPartyNumber], Chr(34))) as [callingPartyNumberNo],

1 Solution

Accepted Solutions
Not applicable

Hi Thom Mumaw ,

Your Expression is correct but youe have check the arrangement of braces.. try the below one..

if (len(trim([callingPartyNumber])) = 13,
PurgeChar([callingPartyNumber], Chr(34)),
if (len(trim([callingPartyNumber])) = 14,
PurgeChar([callingPartyNumber], Chr(34)))) as [callingPartyNumberNo]

View solution in original post

3 Replies
tmumaw
Specialist II
Specialist II
Author

Got it to work missed place ")"

if (len(trim([callingPartyNumber])) = 13,
PurgeChar([callingPartyNumber], Chr(34)),
if (len(trim([callingPartyNumber])) = 14,
PurgeChar([callingPartyNumber], Chr(34)))) as [callingPartyNumberNo],

Not applicable

Hi Thom Mumaw ,

Your Expression is correct but youe have check the arrangement of braces.. try the below one..

if (len(trim([callingPartyNumber])) = 13,
PurgeChar([callingPartyNumber], Chr(34)),
if (len(trim([callingPartyNumber])) = 14,
PurgeChar([callingPartyNumber], Chr(34)))) as [callingPartyNumberNo]

tmumaw
Specialist II
Specialist II
Author

Thanks Arun....must not have enough coffee yet.