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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
mcoetzee
Contributor
Contributor

Special characters in a number field

Hi, 

I have a field (SMSNo) field where cell numbers are captured in, but i have occasions where people capture  special characters in, i want to created an if statement in my script to identify just the client records  whom has a special character in the (SMSNo) field and where the number does not contain 10 digits. I also want to eliminate the fields that are blank.

Thank you

 

 

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use PurgeChar() to remove the valid characters and test the length of remaining

if( Len(PurgeChar(SmsNo, '0123456789')) = 0  and Len(SmsNo) = 10, 'Y', 'N') as [Valid?]

If you need to get more sophisticated, you may consider using regular expressions to validate phone numbers as shown in this example. 

Qlikview Cookbook: Regular Expression Pattern Matching http://qlikviewcookbook.com/recipes/download-info/regular-expression-pattern-matching/

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com

 

View solution in original post

1 Reply
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use PurgeChar() to remove the valid characters and test the length of remaining

if( Len(PurgeChar(SmsNo, '0123456789')) = 0  and Len(SmsNo) = 10, 'Y', 'N') as [Valid?]

If you need to get more sophisticated, you may consider using regular expressions to validate phone numbers as shown in this example. 

Qlikview Cookbook: Regular Expression Pattern Matching http://qlikviewcookbook.com/recipes/download-info/regular-expression-pattern-matching/

-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com