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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

question about GetFieldSelections

Hi,

There's a field Media in my data with three possible values: TV, Press, Internet.

There's a list-box Media in my QlikView file.

I'm using the following function to get selected values:

Variable1=GetFieldSelections(Media)

E.g. if all media are selected, then Variable1 = TV, Press, Internet.

Now I have to set the following condition:

if Variable1 includes 'TV', then return 1, else return 0.

How can I define this condition using QlikView syntax?

Thank you in advance,

Larisa

1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

There are many ways.  For example

if(index(Variable1, 'TV'), 1,0)

View solution in original post

3 Replies
Anonymous
Not applicable
Author

There are many ways.  For example

if(index(Variable1, 'TV'), 1,0)

sunny_talwar

Or this might also work

If(SubStringCount(Variable1, 'TV') = 1, 1, 0)

or you can do this directly without the if statement

SubStringCount(Variable1, 'TV')

HTH

Best,

Sunny

Anonymous
Not applicable
Author

Thank you!