Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exists?

what is the Exists how do they works?

6 Replies
Not applicable
Author

Can you plz explain about Exists in Detail.

ashfaq_haseeb
Champion III
Champion III

Check the below link

http://community.qlik.com/message/583198#583198

Regards

ASHFAQ

maxgro
MVP
MVP

its_anandrjs

Hi,

From the QV help for explaining the Exists

These functions are used when a value from previously loaded records of data is needed for the evaluation of the current record.

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.

Regards,

Anand

jagan
Luminary Alumni
Luminary Alumni

Hi Sampath,

Check this example:

Course_id, Student_id

1,1

1, 2

2,3

2,4

Course_id, Name

1, C

2, C++

3, Java

4, Hibernate

Suppose if you want to load only the courses which has student ID, then Exists comes handy, check below

StudentCourse:

LOAD

*

FROM StudentCourse;

Course:

LOAD

*

FROM Course

WHERE Exists(Course_id);

Now Course table has only 1 and 2, because 3 and 4 do not have any student_ids assigned.

Refer Qlikview help file (F1) for more detailed help, it has lot of examples.

Hope this helps you.

Regards,

Jagan.