Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

MCampestrini
Valued Contributor

Creating temporary tables

Hi!


I have this part of my load script. I'm trying to create multiple QVD files based on a SQL query. Everything seems to work, but the commands inside the FOR...NEXT loop. QV doesn't create the table "NotaFiscal", but stores at NTF table.

NTF:

Select NRNFSC,
       SRNOTA,
       to_date(DTEMIS, 'yyyymmdd') DTEMIS,
       to_date(DTSAID, 'yyyymmdd') DTSAID From rch0090
Where  to_date(dtemis, 'yyyymmdd') >= to_date('01-jan-$(minYearOfLoadingBills)');

FOR varYear = $(minYearOfLoadingBills) TO year(today())
   NotaFiscal:
  
LOAD  *
  resident  NTF WHERE Year(DTEMIS) = $(varYear);
  
STORE     NotaFiscal INTO $(Root)\qvd\rch0090_$(varYear).qvd (qvd);
NEXT;
Drop table NotaFiscal;
Drop table
NTF;

Variable minYearOfLoadingBills has value = 2013.

Anyone can help me?

Márcio Rodrigo Campestrini
1 Solution

Accepted Solutions
MVP
MVP

Re: Creating temporary tables

and also drop table NoteFiscal  inside the loop


NTF:

Select NRNFSC,
       SRNOTA,
       to_date(DTEMIS, 'yyyymmdd') DTEMIS,
       to_date(DTSAID, 'yyyymmdd') DTSAID From rch0090
Where  to_date(dtemis, 'yyyymmdd') >= to_date('01-jan-$(minYearOfLoadingBills)');

FOR varYear = $(minYearOfLoadingBills) TO year(today())
   NotaFiscal:
   BOCONCATENATE                                         

   LOAD  *
  resident  NTF WHERE Year(DTEMIS) = $(varYear);
  
STORE     NotaFiscal INTO $(Root)\qvd\rch0090_$(varYear).qvd (qvd);

   Drop table NotaFiscal;                               

NEXT;
Drop table
NTF;

4 Replies
Not applicable

Re: Creating temporary tables

Since both tables essentially are loading the same information, auto concatenation is taking place and thus assuming the first table alias

Write this in your loop statement

NotaFiscal:

NOCONCATENATE

Load *

.

.

.

.

Next;

MVP
MVP

Re: Creating temporary tables

and also drop table NoteFiscal  inside the loop


NTF:

Select NRNFSC,
       SRNOTA,
       to_date(DTEMIS, 'yyyymmdd') DTEMIS,
       to_date(DTSAID, 'yyyymmdd') DTSAID From rch0090
Where  to_date(dtemis, 'yyyymmdd') >= to_date('01-jan-$(minYearOfLoadingBills)');

FOR varYear = $(minYearOfLoadingBills) TO year(today())
   NotaFiscal:
   BOCONCATENATE                                         

   LOAD  *
  resident  NTF WHERE Year(DTEMIS) = $(varYear);
  
STORE     NotaFiscal INTO $(Root)\qvd\rch0090_$(varYear).qvd (qvd);

   Drop table NotaFiscal;                               

NEXT;
Drop table
NTF;

MCampestrini
Valued Contributor

Re: Creating temporary tables

Thanks Byron. It worked just fine!

Márcio Rodrigo Campestrini
Not applicable

Re: Creating temporary tables

ooh yes, forgot about the drop table Thanks Massimo

Community Browser