Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Error in looping

Hi,

Can anybody help me to understand the error in following looping part:

let Vrowcount=NoOfRows('Temp');

for i=1 to $(VrowCount)

let VAccuCL=if(%PAYCODE <> previous('%PAYCODE'), Accu_CL, peek('ClosingBalance',$(i),'Temp'));

let VCLAccrued=FieldValue('CLA',$(i));

let VCLclosingbalance=rangesum(if(%PAYCODE <>previous(%PAYCODE),Accu_CL,peek('ClosingBalance',$(i),'Temp')),-$(VCLAccrued));

   

next;

Please suggest.

5 Replies
CELAMBARASAN
Partner - Champion
Partner - Champion

Hi,


previous('%PAYCODE') will cause the error


Previous function cannot be used outside of the LOAD statement.

senpradip007
Specialist III
Specialist III

Look into the variable name you are using QlikView Script is case sensitive.

for i=1 to $(VrowCount)

Anonymous
Not applicable
Author

Are you sure?

should I replace it with peek()?

CELAMBARASAN
Partner - Champion
Partner - Champion

Yeah and also you cannot use %PAYCODE field as it is, outside the load script.

Can you tell what you are trying to do

Anonymous
Not applicable
Author

Thanks Pradip,

Could you help me how I can use these variable at front end?

Is $(Variablename)  enough?