Discussion Board for collaboration on QlikView Scripting.
I stumbled in a requirement where I must autogenerate NoOfRow() inside loop.
Specifically, this application is used as a source file for labels. The user put an excel file, where [a.] part number; [b.] Maximum number of labels to print.
The script should produce such result:
I have initially authored such script:
T1: Load [Part Number] as P#, [Maximum Number of Labels] as Max from (Source Excel);
//Getting maximum number of rows in the source file
Let noRows = NoOfRows('T1')
//define loop condition
for i=0 to $(noRows)-1
Let a = peek ('P#', $(i), 'T1');
Let b = peek ('Max', $(i), 'T1');
//Generate serialised number
T2: Load RowNo() as Serial Autogenerate $(b),
However; it seems $(b) is not passed. Just error and stops execution.
I would appreciate for any help on this script.
Go to Solution.
Try using the while keyword:
LOAD *, iterno() as RecNo
while IterNo() <= [Maximum Number of Labels]
Thanks, I am trying now.
Excellent it is working. IterNo() is used as serial, and while ..... close was used as condition. I appreciate for your fast and elegant resolution.
Load * Inline
Part Number, Label
IterNo() as NO
While IterNo() <= Label;
Drop Table Temp;
I appreciate for your support too. Your solution is working. I deeply appreciate for your fast resolution. Atsushi