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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Using Exists() in IF Statement

I am trying to use the Exists() function in an IF Statement:

IF Exists([LogFilePath], '123') THEN

  EXIT SUB; // Already processed, skip it

  ENDIF

The IF line throws a general error in all versions of QV I've tested (10, 11, 12).  The [LogFilePath] field does exist.

The Help for QV12 Exists states:

'can be used in the where clause of a LOAD statement or an IF statement."


The QV11 Help says nothing about where it can be used.  So is this a bug (or my coding error) that it won't work in an IF? Or is the Doc wrong?


-Rob

Labels (3)
1 Solution

Accepted Solutions
rbecher
MVP
MVP

Hi Rob,

first time I tried to use Exists() outside of LOAD and it seems to work with quoted field:

Test:

LOAD * INLINE [

    F1

    A

    B

    C

];

IF Exists('F1', 'B') THEN

    TRACE B exists!;

END IF

IF Exists('F1', 'X') THEN

    TRACE X exists!;

END IF

Tested with QV 11.20 SR14

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine

View solution in original post

2 Replies
rbecher
MVP
MVP

Hi Rob,

first time I tried to use Exists() outside of LOAD and it seems to work with quoted field:

Test:

LOAD * INLINE [

    F1

    A

    B

    C

];

IF Exists('F1', 'B') THEN

    TRACE B exists!;

END IF

IF Exists('F1', 'X') THEN

    TRACE X exists!;

END IF

Tested with QV 11.20 SR14

- Ralf

Data & AI Engineer at Orionbelt.ai - a GenAI Semantic Layer Venture, Inventor of Astrato Engine
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP
Author

Thanks Ralf! The quotes was what I needed.

-Rob