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: 
stonecold111
Creator III
Creator III

Exists function. Exist(id,id)

Hi Qlikss.

In my script part when loading from oracle database

script is like this:

load *

where exists(id,id);

sql select id,

group,

data,

..

from table;

why they used exists(id,id).   why can't we use simple exists(id)

someone explain plz

1 Solution

Accepted Solutions
avinashelite

Check if already loaded table has a column called id ? then this table will load only the data i.e. id which are present in the previously loaded table

exists(field [ , expression ] )

Determines whether a specific field value exists in a specified field of the data loaded so far. Field is a name or a string expression evaluating to a field name. The field must exist in the data loaded so far by the script. Expr is an expression evaluating to the field value to look for in the specified field. If omitted, the current record’s value in the specified field will be assumed.

Examples:

exists(Month, 'Jan') returns -1 (true) if the field value 'Jan' is found in the current content of the field Month.

exists(IDnr, IDnr) returns -1 (true) if the value of the field IDnr in the current record already exists in any previously read record containing that field.

exists (IDnr) is identical to the previous example.

Load Employee, ID, Salary from Employees.csv;
Load FirstName& ' ' &LastName as Employee, Comment from Citizens.csv where exists (Employee, FirstName& ' ' &LastName);
Only comments regarding those citizens who are employees are read.

Load A, B, C, from Employees.csv where not exists (A);
This is equivalent to performing a distinct load on field A.

View solution in original post

5 Replies
avinashelite

When the field names are same then you can use exists(id) or exists(id,id)  functionality will be same

stonecold111
Creator III
Creator III
Author

i have only one field id

not fields

rahulpawarb
Specialist III
Specialist III

Hello Suresh,

Exists function accepts at least one parameter (where field name is common in both the tables) and at max two parameters (where field name is different in both the tables).  In given example, exists(id,id) as well as exists(id) will work fine.


Regards!

Rahul

avinashelite

Check if already loaded table has a column called id ? then this table will load only the data i.e. id which are present in the previously loaded table

exists(field [ , expression ] )

Determines whether a specific field value exists in a specified field of the data loaded so far. Field is a name or a string expression evaluating to a field name. The field must exist in the data loaded so far by the script. Expr is an expression evaluating to the field value to look for in the specified field. If omitted, the current record’s value in the specified field will be assumed.

Examples:

exists(Month, 'Jan') returns -1 (true) if the field value 'Jan' is found in the current content of the field Month.

exists(IDnr, IDnr) returns -1 (true) if the value of the field IDnr in the current record already exists in any previously read record containing that field.

exists (IDnr) is identical to the previous example.

Load Employee, ID, Salary from Employees.csv;
Load FirstName& ' ' &LastName as Employee, Comment from Citizens.csv where exists (Employee, FirstName& ' ' &LastName);
Only comments regarding those citizens who are employees are read.

Load A, B, C, from Employees.csv where not exists (A);
This is equivalent to performing a distinct load on field A.

stonecold111
Creator III
Creator III
Author

yes you are right.

there is already loaded table before that with column id