Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
michielvandegoo
Valued Contributor

For each + autogenerate + while gives .... -1, ....-2 tables

I have the following statement:

let aantal_te_loggen = NoOfRows('To_log');

for  loggen = 0 to NoOfRows('To_log')

let bestand_to_log = peek('bestand',loggen,'To_log');

Logbestand:

load  '$(bestand_to_log)' as Bestand,

  filetime('$(bestand_to_log)') as '$(bestand_to_log)'

AutoGenerate (1)

while 0 + IterNo( )-1 <= '$(aantal_te_loggen)';

next loggen

This should generate 1 table with the filename and the filetime based on a inline table with those filenames.

I do not get all results. I only get the second line from the inline table and for each  line a table with Logbestand-1, Logbestand-2 etc. etc.

What am I doing wrong?

1 Solution

Accepted Solutions
Not applicable

Re: For each + autogenerate + while gives .... -1, ....-2 tables

Michiel,

 

let aantal_te_loggen= NoOfRows('To_log');

for loggen= 0 to NoOfRows('To_log')-1

let bestand_to_log= peek('bestand',loggen,'To_log');

Logbestand:

load '$(bestand_to_log)' asBestand,
filetime('$(bestand_to_log)') as FileTime


AutoGenerate (1)
// while 0 + IterNo( )-1 <= '$(aantal_te_loggen)'

;

next loggen


NoOfRows -1 (because the start is 0)

as FileTime: to get a unique field name and get a unique table

//while (if you do not use iterNo(), why do you need to loop ?)

Hope this helps

Fabrice

2 Replies
Not applicable

Re: For each + autogenerate + while gives .... -1, ....-2 tables

Michiel,

 

let aantal_te_loggen= NoOfRows('To_log');

for loggen= 0 to NoOfRows('To_log')-1

let bestand_to_log= peek('bestand',loggen,'To_log');

Logbestand:

load '$(bestand_to_log)' asBestand,
filetime('$(bestand_to_log)') as FileTime


AutoGenerate (1)
// while 0 + IterNo( )-1 <= '$(aantal_te_loggen)'

;

next loggen


NoOfRows -1 (because the start is 0)

as FileTime: to get a unique field name and get a unique table

//while (if you do not use iterNo(), why do you need to loop ?)

Hope this helps

Fabrice

mov
Esteemed Contributor III

Re: For each + autogenerate + while gives .... -1, ....-2 tables

The tables in the loop have different structure, hence they don't collapse into one table.  What about this.

let aantal_te_loggen = NoOfRows('To_log');

Logbestand:
LOAD * INLINE [
Bestand];


for  loggen = 0 to NoOfRows('To_log')

let bestand_to_log = peek('bestand',loggen,'To_log');


CONCATENATE (Logbestand)

load  '$(bestand_to_log)' as Bestand,

  filetime('$(bestand_to_log)') as '$(bestand_to_log)'

AutoGenerate (1)

while 0 + IterNo( )-1 <= '$(aantal_te_loggen)';


next loggen

Community Browser