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.
joris_lansdaal
Contributor

Loop with variable. but the loop keeps running

Hi All,

I use a loop together with a variable VarRow. The table conains 5 rows and VarRow =5. But When I run below script (part of) the loops just keeps on going.

Any tips?

Rownr:
     Load Max(Rows) as MaxRow
     Resident Tmp_Agreements1;

Set VarRow = MaxRow;

For I =0 to VarRow

Tmp_BridgeTable:
Load
distinct Productgroep as Bonus_Productgroep ,
Peek('Agree_End_Date',$(I),'Tmp_Agreements1') as Agree_End_Date ,
Peek('Agree_Start_Date',$(I),'Tmp_Agreements1') as Agree_Start_Date ,
Peek('Bonus_Hoofdorganisatie',$(I),'Tmp_Agreements1')as Bonus_Hoofdorganisatie,
Peek('Bonus_Abs',$(I),'Tmp_Agreements1')as Bonus_Abs,
Peek('Bonus_%',$(I),'Tmp_Agreements1')as Bonus_%,
Peek('Bonus_Base',$(I),'Tmp_Agreements1') as Bonus_Base,
Peek('Bonus_Artnr',$(I),'Tmp_Agreements1') as Bonus_Artnr,
Peek('Agreement_Description',$(I),'Tmp_Agreements1')as Agreement_Description,
Peek('Overeenkomst',$(I),'Tmp_Agreements1')as Overeenkomst
Resident Sales_Lines ;
Next I

1 Solution

Accepted Solutions
MVP
MVP

Re: Loop with variable. but the loop keeps running

Set VarRow = Peek('MaxRow',0,'Rownr');


Drop Table Rownr;


For I =0 to '$(VarRow)'-1

4 Replies
MVP
MVP

Re: Loop with variable. but the loop keeps running

Set VarRow = Peek('MaxRow',0,'Rownr');


Drop Table Rownr;


For I =0 to '$(VarRow)'-1

joris_lansdaal
Contributor

Re: Loop with variable. but the loop keeps running

error.PNG

Thanks, but i get an error

joris_lansdaal
Contributor

Re: Loop with variable. but the loop keeps running

But with Let instead of Set it works

MVP
MVP

Re: Loop with variable. but the loop keeps running

Use Single Quotes...

May be

Let VarRow = Num(Peek('MaxRow',0,'Rownr'));

Community Browser