Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exists Question

Hi,

In my load statement I have the following conditional where clause

WHERE exists(PropertyID) and exists(AccommodationTypeID,AccomTypeID)

Instead of applying during load, I want to create a flag for this condition, using the following expression in the load field section

if(exists(PropertyID) and exists(AccommodationTypeID,AccomTypeID),1,0) as PropertyIDFLAG

The PropertyIDFLAG does not flag the same fields as that of my conditional where. Could someone explain why

Thanks,

Byron

5 Replies
antoniotiman
Master III
Master III

Hi Byron,

I think that If() works on the already  records loaded at the moment, in a different way Where.

Regards,

Antonio

Not applicable
Author

Thanks for your reply Antonio.

I would like someone to confirm your finding on this, because the expression itself is very simple and so the output is not what I expected to see.

Cheers,

Byron

anbu1984
Master III
Master III

If PropertyID is already loaded, then Flag is set to 1.

A:

Load * Inline [

PropertyID

1

2 ];

NoConcatenate

B:

Load *, If(Exists(PropertyID),1,0) As Flag Inline [

PropertyID

1

4

2

5];

martinpohl
Partner - Master
Partner - Master

Hello Byron,

in the load statement you load fields within values exists 1 and exists 2.

But they don't have to be in the same line.

In the Flagstatement the condition is checked in each line and the flag is only set if the flags exists in both fields.

For same result you need an or, I think

Regards

Not applicable
Author

Hi Martin,

Tried the or approach and that did not work either. I will give anbu's suggestion a try even though I am doing this on the main load, not a resident but will create a resident load to test this approach. I find it odd that in the exists clause it handles the expression exactly like I want but as soon as I load it as a calculated field it does not.

Will reply as soon as I have checked both responses

Cheers,

Byron