Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
CK_WAKE
Contributor III
Contributor III

STRING Matching to apply filter

Hi There,

I have a column that contains a string such as ABC; if the string matches 'ABC', then tag it as 'ABC' else ', Non-ABC'. I tried Wild Match and Found one of the functions but did not get the result I expected.

IF(WildMatch(DESC, '*ABC*'), 'ABC', 'Non ABC') AS IDENTIFIER

IF(
If(FindOneOf(DESC, 'ABC', ' ABC'), 1, 0) > 0,
'ABC',
'Non ABC'
) AS IDENTIFIER

Note: The patterns of the ABC in the column Desc is like 'ABC:-123456' , 'ABC- CA1234', 'ABC 12345', '12AC - ABC', 'CE-123ABC'. Appreciate your help on this. 

Labels (6)
1 Solution

Accepted Solutions
CK_WAKE
Contributor III
Contributor III
Author

Hi There,
I have fixed this. Earlier, I had another subquery to perform all sorts of conditions and join it back to the main table. I removed that subquery and used the condition in the QVD load itself, and now I can see that the condition is working correctly.

View solution in original post

8 Replies
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi

Your IF(WildMatch(DESC, '*ABC*'), 'ABC', 'Non ABC') AS IDENTIFIER should work as well as just simple IF(DESC like '*ABC*', 'ABC', 'Non ABC')

The question is in what scenario you noticed that your function did not work?

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
CK_WAKE
Contributor III
Contributor III
Author

Hi There, Thanks for getting back.
I put the DESC column in to table chart and identifier as a filter when i applied the filter for Non ABC, i can still see the records which contains ABC.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

what values were identified wrongly - can you share example?

I suggest to put just those 2 columns in the table, select Non ABC and give us a screenshot of the record which has ABC in it. Have you tried with the "like" function like i suggested?

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
CK_WAKE
Contributor III
Contributor III
Author

Hi This is the actual code, in the WORD_DESC column if i see string matching TCS then tag it as Before Clash else After Clash Trying to attach the screen shot of the column, not sure if it gets uploaded here.  

IF(WORD_DESC like '*TCS*', 'Before Clash', 'After Clash') as DEFECT_BEFORE_AFTER_CLASH_IDENTIFIER

 

CK_WAKE
Contributor III
Contributor III
Author

This is how the column looks like after applying the filter, it still shows some of the records which contains string like TCS

CK_WAKE
Contributor III
Contributor III
Author

Hi There, i have saved the data in to this excel file.

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

hard to say. 

in your formula you are using WORD_DESC field in your chart you put some other field  with label WO DESC. The reason I asked about the 2 fields you are using in your expression was to make sure you are not using similar fields which could be transformed. I am just trying to make sure you are not using different fields. 

Also - you may as well try and copy text from the actual field just to make sure those TCS letters are not some special characters.

Otherwise I have no explanation. This is very odd and to be able to say more we would need to probably see your whole script and data model viewer. That would exclude situations where maybe you are (auto)concatenating some records or maybe your model is doing something what is causing incosistent results. 

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
CK_WAKE
Contributor III
Contributor III
Author

Hi There,
I have fixed this. Earlier, I had another subquery to perform all sorts of conditions and join it back to the main table. I removed that subquery and used the condition in the QVD load itself, and now I can see that the condition is working correctly.