Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

EXISTS() agony

Hi All,

I’m having a really annoying problem with the EXISTS() statement, and I’m going round the bend.

Here’s the set up:

 

The database I’m working with has somewhere in the neighborhood of 3 million records. The majority of them have no related records in the database, and as a result, I don’t want them clogging up my dashboard.

I’m loading a number of other related objects first in order to create the list of users that I do want in the dashboard, all sharing a field which has been aliased (using the AS keyword) to [Member ID]. 

In the table I’m loading from, the member ID is called V_ID, and I’m doing this:

LOAD
    
V_ID as [Member ID]

And, at the end of my load statement, I’m attempting to use EXISTS, and it keeps telling me the field doesn’t exist. I’ve tried:

 

WHERE EXISTS(V_ID, [Member ID]);

WHERE EXISTS(V_ID, “Member ID”);

 

These two give me ‘Field <Member ID> does not exist’ errors.

I’ve tried a few other more random things that don’t warrant description, to no avail. And the field name has been copied and pasted from the alias in previous tables, so it's not a spelling issue.

It seems like a pretty straight forward thing to do, but it’s not working.

I've also tried scouring the forums, and I see lots of other posts, and people gleefully using exists() in this way, but it doesn't seem to work for me.

Help?

1 Solution

Accepted Solutions
Not applicable
Author

If I am understanding, you are loading some data:

LOAD

... AS [Member ID]

...;

and then you are trying to load only desired rows from a database something like this...

LOAD

V_ID as [Member ID]

...

The exist statement should look like this ...

LOAD

V_ID as [Member ID]

...

WHERE EXISTS([Member ID], V_ID);

The first parameter in the exist clause references the previously loaded data (after any aliasing) and the second parameter references the field (before aliasing) from the current table you are loading.

Hope this helps.

View solution in original post

1 Reply
Not applicable
Author

If I am understanding, you are loading some data:

LOAD

... AS [Member ID]

...;

and then you are trying to load only desired rows from a database something like this...

LOAD

V_ID as [Member ID]

...

The exist statement should look like this ...

LOAD

V_ID as [Member ID]

...

WHERE EXISTS([Member ID], V_ID);

The first parameter in the exist clause references the previously loaded data (after any aliasing) and the second parameter references the field (before aliasing) from the current table you are loading.

Hope this helps.