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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Any function can get the 'exist' result?

Hi,

I have a varible named v_year and a table like:

Year
2008
2007
2001


I want to get a function which can return a ture-or-false value:

TURE : if $(v_year) exist in field [Year]

FALSE: if $(v_year) not exist in field [Year]

How can I write the expression? Any function can do that? I want to use the expression as a condition in if clause.

Labels (1)
3 Replies
tresB
Champion III
Champion III

if you are trying in the script, you can create flag like this:

LOAD Year,

If(Year='$(v_year)',1,0) as MatchFlag From ....

otherwise there is a function called EXISTS().... you can have a look at it.

Regards, tresesco.

pover
Partner - Master
Partner - Master

Here's one option:

=if(only({$<Year={$(vYear)}>} Year),'Exists','Does not Exist')

Regards.

Not applicable
Author

Hi,

The condition is not work. May be NOT(ISNULL(ONLY(....))) is ok.