Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
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.

3 Replies
tresesco
MVP
MVP

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
Luminary Alumni
Luminary Alumni

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.