Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
alec1982
Specialist II
Specialist II

find if a value exist inside a field or a varriable

hi guys,

how can i find if a value exists within a field or variable.

for example a variable is made of concat(field,;) and has Red; yellow;Green.

I want a text box with if statement to show 1 if the yellow exist within the variable and 0 if not..

1 Solution

Accepted Solutions
Anonymous
Not applicable

if ( index ( [YourField] , 'yellow' ) > 0 , 1 , 0 )   

View solution in original post

4 Replies
ThornOfCrowns
Specialist II
Specialist II

Use Index or SubStringCount

index(s1 , s2[ , n])

Position of a substring. This function gives the starting position of the n:th occurrence of substring s2 in string s1. If n is omitted, the first occurrence is assumed. If n is negative, the search is made starting from the end of string s1. The result is an integer. The positions in the string are numbered from 1 and up.

substringcount( text , substring)

Returns the number of times the string substring appears within the string text. The result is an integer. If there is no match, 0 is returned

Anonymous
Not applicable

if ( index ( [YourField] , 'yellow' ) > 0 , 1 , 0 )   

Not applicable

try like this

if(match(variablename,'yellow'),1,0)

or

if($(variablrname)=yellow),1,0)

alec1982
Specialist II
Specialist II
Author

Thank you!