Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
joris_lansdaal
Creator
Creator

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
MK_QSL
MVP
MVP

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


Drop Table Rownr;


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

View solution in original post

4 Replies
MK_QSL
MVP
MVP

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


Drop Table Rownr;


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

joris_lansdaal
Creator
Creator
Author

error.PNG

Thanks, but i get an error

joris_lansdaal
Creator
Creator
Author

But with Let instead of Set it works

MK_QSL
MVP
MVP

Use Single Quotes...

May be

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