Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
bullish35
Creator II
Creator II

How can I set the value of a variable based on whether or not a field CONTAINS a specific value?

I have a field, Channel, which contains a different set of values for each item in my table. I would like to set several variables based on the contents of the Channel field for a particular row item. I do not want to evaluate the entire column in my table.

Example,

For a selected item, the value of Channel = EJ, SM, WH. Since Channel contains EJ, I want to set the value of my variable, vSelectEJ = 1. Since Channel contains SM, I want to set the value vSelectSM = 1. Since Channel does not contain RLO, I want to set the value of vSelectRLO = 0.

That is, if Channel contains EJ, set vSelectEJ=1.

Any suggestions would be greatly appreciated. Thank you.

6 Replies
maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

U can use the if(count(if(Channel='EJ',1))>0,1,0) in variable value assignment.

Good Luck

Smile

bullish35
Creator II
Creator II
Author

Thank you Manesh. This seems to work if the value of my field equals 'EJ' or 'SM', etc. But, the function has to evaluate whether or not my field contains 'EJ', 'SM', etc. Most of the Channel fields for an item contain a reference to several different channels. Does that make sense?

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

Use the provided solution. if not working then send me a sample application. I will surly help u.

Anonymous
Not applicable

Ellen,

Take a look at the string functions in the F1 help. Useful functions here might be FindOneOf() or Index()

bullish35
Creator II
Creator II
Author

Thank you. I'll look this over again. I tried the substringcount function but didn't receive the expected results.

maneshkhottcpl
Partner - Creator III
Partner - Creator III

Hi,

Please send me a sample data i will work on it and resolved ur problem.