
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Validity of a phone number
Hi
I have a members table with a column for cell phone numbers, and I need to output members with cell phone numbers that are invalid (less/more than 10 digits).
Can anyone suggest the best way of doing this?
I thought about using mapping as an indicator of which cell numbers are valid and which aren't but I am battling with creating an IF statement for how many digits the cell number is.
Would appreciate any help!
Thanks so much
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
suggest the len() function
You can either perform
If(len(cellphione) <> 10, 'Invalid,cellphone)
or
if (len(cell phone = 10, cellphone,invalid)
just a matter of do you want to interrogate for a good or bad - the results will be the same


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can use keepchar to create a new field with only digits:
keepchar ( Phone,'0123456789' ) as PhoneDigits;
Then look at len(PhoneDigits):
if(len(PhoneDigits)<>10,"Invalid','Valid') as PhoneValid;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
suggest the len() function
You can either perform
If(len(cellphione) <> 10, 'Invalid,cellphone)
or
if (len(cell phone = 10, cellphone,invalid)
just a matter of do you want to interrogate for a good or bad - the results will be the same


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
please provide sample data


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You could use the if condition as below
if(len(trim(PhoneNo))=10,'Yes','No') as IsPhoneNoValid;


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
you could also use regular expressions for this task.
Here are some links on using RegEx in QlikView:
- http://www.qlikfix.com/2010/10/18/regular-expressions-in-the-load-script/ by Barry Harmsen
- How to use regular expressions by Andrea Ghirardello
Maybe also helpful for recognizing "outliers" of the phone number patterns:
Re: Please help me get the string pattern of each field.
please try to avoid multiple threads for the same question:
hope this helps
regards
Marco
