Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Finding Records having a Character in ID field


Hi,

I have a data set having ID as one of the fields. Ideally ID should be numeric; eg- 1234. In few of the records,there is a character 'P' appended at the end of the ID, eg-1234P. How can I find those records in my script ?

Actually, I want to identify those records and assign them a special status eg- Wrong Data whereas for all others I want this status to be Right Data so that in the front end I can use expressions excluding thhose Wrong data records.

1 Solution

Accepted Solutions
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

LOAD ID,

     If(Right(ID, 1) = 'P', 'Wrong', 'Right') As Flag,

     ...

or, to be more general:

     If(IsNum(ID), 'Wrong', 'Right') As Flag,

     If(IsNum(ID), 'Right', 'Wrong') As Flag,

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

LOAD ID,

     If(Right(ID, 1) = 'P', 'Wrong', 'Right') As Flag,

     ...

or, to be more general:

     If(IsNum(ID), 'Wrong', 'Right') As Flag,

     If(IsNum(ID), 'Right', 'Wrong') As Flag,

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
CELAMBARASAN
Partner - Champion
Partner - Champion

Change in logic:

If(not IsNum(ID), 'Wrong', 'Right') As Flag

MarcoWedel

LOAD ID,

           IF(IsNum(ID),'Right','Wrong')&' Data' as Status

Form yoursource;