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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Exists Function issue.

Hi,

I'm a very new QV user and I'm trying to build a very simple load script which has to flag the first occurrence of a value in a given field, let's say the Customer_ID one.

Looking at some of the posted thread about the exists function, I tried something like this:

LOAD @1 as F_Customer_ID,

          if (Exists (@1), 'NO', 'YES') as First_Fruition_FLG,

          @3 as FruitionTimeStamp,

                  MakeDate (Left(@3, 4), Mid(@3,5,2), Mid(@3,7,2)) as FruitionDate,

          WeekName(MakeDate (Left(@3, 4), Mid(@3,5,2), Mid(@3,7,2))) as FruitionWeek,

          MonthName(MakeDate (Left(@3, 4), Mid(@3,5,2), Mid(@3,7,2))) as FruitionMonth

FROM <xls file path and name>

and what I got is that it seems that tool isn't able to find out any value.

The First_Fruition_FLG column has always the YES value.

Any help?

Thanks a lot, Luigi.

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You are renaming the @1 field, so I think that's the issue QV can't find any existing values - the field does not exist in the data model.

Try the 2 argument version of exists:

  if (Exists (F_Customer_ID, @1), 'NO', 'YES') as First_Fruition_FLG,

View solution in original post

3 Replies
MayilVahanan

Hi

Try like this

if(Previous(@1) = @1,'Yes','No') as First_Fruition_FLG,

Hope that helps

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.
swuehl
MVP
MVP

You are renaming the @1 field, so I think that's the issue QV can't find any existing values - the field does not exist in the data model.

Try the 2 argument version of exists:

  if (Exists (F_Customer_ID, @1), 'NO', 'YES') as First_Fruition_FLG,

Not applicable
Author

Thanks a lot, your tip was successful.

Best regards, Luigi.