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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Asiolinka
Contributor III
Contributor III

How check if the field has the same characters combination?

Hi,

Hope it will be my last question today. 

I need to find uncorrect combinations of number in one field. 

The correct format should be:  9 characters and first 2 should be letters (for example: AB 1234567).

Thank you for any ideas. I started with len 9 chr but I also need to see all the records with special characters, with more than two letters etc.

 

 

Labels (1)
1 Solution

Accepted Solutions
Kushal_Chawda

@Asiolinka  try below

LOAD FIELD,
-(len(FIELD)=9 and istext(Left(FIELD,2)) and isnum(right(FIELD,7))) as Flag 
FROM table

View solution in original post

4 Replies
Asiolinka
Contributor III
Contributor III
Author

Flag is my expected output. 

Correct every single time if record= 2 first letters + 5 numbers

FIELD Flag 
AA1234567 1
AB1334567 1
GH1232342 1
ABC1234567 0
AF12F4567 0
AB12*4567 0
DS395
Contributor III
Contributor III

Hi Asiolinka,

i hope this will help you:

LOAD
[FIELD],
IF(LEN([FIELD])<>9,0,
IF(LEN(KEEPCHAR(UPPER(LEFT([FIELD],2)),'ABCDEFGHIJKLMNOPQRSTUVWXYZ'))<>2,0,
IF(LEN(KEEPCHAR(UPPER(RIGHT([FIELD],7)),'0123456789'))<>7,0,1))) AS FLAG
INLINE
[
FIELD
AA1234567
AB1334567
GH1232342
ABC1234567
AF12F4567
AB12*4567
];

 

example2.png

IF you only accept uppercase letters, then u have to remove the UPPER()-Function in the IF-Statement.

Best regards

dash

Kushal_Chawda

@Asiolinka  try below

LOAD FIELD,
-(len(FIELD)=9 and istext(Left(FIELD,2)) and isnum(right(FIELD,7))) as Flag 
FROM table
Asiolinka
Contributor III
Contributor III
Author

Thank you very, very, very much!