Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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
MVP
MVP

Re: Exists Function issue.

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,

3 Replies

Re: Exists Function issue.

Hi

Try like this

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

Hope that helps

MVP
MVP

Re: Exists Function issue.

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

Re: Exists Function issue.

Thanks a lot, your tip was successful.

Best regards, Luigi.

Community Browser