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: 
Not applicable

simple if contains statement

I know this must be a simple one to solve but I cant figue it out. I'm trying to break up some data based upon an ID field. If the ID begins with v then its a product else its an order. Currently running the below everything is displaying as an order, im guessing this be because its using the * as a character instead of a wildcard.

Can someone please point me in the right direction?


if("ID"='v*', 'products', 'orders') as datatype


Thanks

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

Use the following:

=IF(WILDMATCH(ID, 'V*'), 'products', 'orders')


Hope that helps

View solution in original post

3 Replies
Miguel_Angel_Baeyens

Hello,

Use the following:

=IF(WILDMATCH(ID, 'V*'), 'products', 'orders')


Hope that helps

Not applicable
Author

Many thanks, works perfectly!

nickmarlborough
Creator
Creator

How would i do this with multiple instances?

For example: 

If i have x3 different categories - 'Fruit' , 'Vegetable' , 'Meat' and i want to create a new column that when the Category contains 'Fruit' it is the combination of Field: TYPE and Field: COLOUR but when Category contains 'Vegetable' it is the combination of Field: TYPE and Field: SIZE but when it contains 'Meat' it is the Field: #of pieces (this is an integer) and anything else in CATEGORY is Null.

Hope this is explained well,