Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

Announcements
Leverage your QlikView investment to modernize BI – see how! Join Group
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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
Highlighted
MVP & Luminary
MVP & Luminary

Re: Special characters in a number field

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
Highlighted
MVP & Luminary
MVP & Luminary

Re: Special characters in a number field

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