Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

harleen_singh
Contributor III

loop, concatenate and exist function together

How to use Exist function inside loop?

my question is when we do loop we cannot drop the table because i need to concatenate all things of loop together.

But i want exit function should work on each and every table created in the loop separately.

If you look at code below i cannot drop table hence exits function will not work for each table separately.

or j=2012 to 2012

for i=1 to 3

customerloop:

LOAD

ID as ID1,

EntryType,

INVOICEACCOUNT,

MonthName,

DATAAREAID1 as DATAAREAID,

MetricID

Resident

Customer

where Year(MonthName)=$(j) and Month(MonthName)=$(i);

Concatenate

LOAD

  1 as ID1,

     0 as EntryType,    

     4 as MetricID,

     MonthName(Date('01/$(i)/$(j)')) as MonthName,

     Upper(text(ID)) as DATAAREAID

   //  NAME as Company

    

FROM

MasterCompanies;

where not Exists(DATAAREAID,ID) and [ISVIRTUAL]=0 and ID<>'0000';

NEXT i;

NEXT j;

1 Reply
Not applicable

Re: loop, concatenate and exist function together

Hi,

The function exists() seems correct ... but you cannot use DATAAREAID in it (because QV does not know it yet, because you used AS) => you have to use upper(text(ID)) instead.

Fabrice

Community Browser