Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

how to validate phone number in a table

i am looking for the code in phone number validation in a table..

9 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

I think the best way is to validate it in the script using a Regular Expression. See this for an example:

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

-Rob

http://masterssummit.com

http://robwunderlich.com

robert_mika
Master III
Master III

Could you post examples?

Not applicable
Author

sorry robert..i  have no examples..because present i am learning in qlikview.. please  guide me how to write the code..i know isnum function is helpful to my code..but i don't know how to keep that function in my code..

jagan
Luminary Alumni
Luminary Alumni

Hi Venu,

Try like this

Data:

LOAD

*,

If(IsNum(PhoneNumber), 'Valid', 'Invalid') AS IsValidPhoneNumber

FROM DataSource;

Regards,

Jagan.

Not applicable
Author

thankyou  very much jagan its working..when i am enter the 11 digits numbers in the fields..the output will be comes in valid..but i want  to display invalid..

jyothish8807
Master II
Master II

Hi Venu,

Try like this:

If(len(PhoneNumber)='10', 'Valid', 'Invalid') AS IsValidPhoneNumber

Regards

KC

Best Regards,
KC
jyothish8807
Master II
Master II

for better validation try this:

If(len(PhoneNumber)='10' and isnum(PhoneNumber), 'Valid', 'Invalid') AS IsValidPhoneNumber

Regards

KC

Best Regards,
KC
robert_mika
Master III
Master III

If that's coming from a system(well or even manually entered I would use:

If(len(trim(PhoneNumber))='10' , 'Valid', 'Invalid') AS IsValidPhoneNumber


jagan
Luminary Alumni
Luminary Alumni

Hi,

Then check this option

Data:

LOAD

*,

If(IsNum(PhoneNumber) AND len(PhoneNumber)='10', 'Valid', 'Invalid') AS IsValidPhoneNumber

FROM DataSource;

Hope this helps you.

Regards,

Jagan.