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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
juliakhaa
Creator
Creator

How to pull a certain word from a field (set a condition/flag on it)

Hello, Qlik Sense community.
I am a new user, so I really need your help/advice.

To briefly break it down, I have a field that is a huge or not so 'messy text', I need to extract a certain word from that and flag that yes, that word is indeed there.

For example, I have one field with a 'dirty' string, the second field is a flag that will show 1 if there is the word 'URVKK' in the string.
Let's say the value of the first field -->
CRM - URVKK - 220408 - 0900 - 08666/r/n/GPA, the next field is a flag that will show 1.

Tried to write the following query, did not help -->
if ([column_1] like '%URVKK%', 1, 0) as flg


ps. dirty text can look different, i.e. it can be: 87678909URVKK; controlurvkk/n/r/

Can you tell me if there is any way to implement this, thanks

Labels (5)
1 Solution

Accepted Solutions
MarcoWedel

you used the wrong wildcard characters with your like operation

 

if ([column_1] like '*URVKK*', 1, 0) as flg

 

might work instead.

If the search string is one of a fixed, limited set of strings then you could also use the WildMatch() function:

if (WildMatch([column_1], '*87678909URVKK*', '*controlurvkk*'), 1, 0) as flg

 

If there are lots of search strings or dynamically changing ones that have to be loaded from some source then you could use a mapping load / MapSubString() approach to check for the presence of those strings.

hope this helps

Marco

 

 

View solution in original post

2 Replies
MarcoWedel

you used the wrong wildcard characters with your like operation

 

if ([column_1] like '*URVKK*', 1, 0) as flg

 

might work instead.

If the search string is one of a fixed, limited set of strings then you could also use the WildMatch() function:

if (WildMatch([column_1], '*87678909URVKK*', '*controlurvkk*'), 1, 0) as flg

 

If there are lots of search strings or dynamically changing ones that have to be loaded from some source then you could use a mapping load / MapSubString() approach to check for the presence of those strings.

hope this helps

Marco

 

 

juliakhaa
Creator
Creator
Author

Thank you so much, you very help me