Discussion Board for collaboration on QlikView Scripting.
I am trying to use For loop using a variable which has been assigned a value using count function:
Let vLoop = '=Count(DISTINCT abc)'
For i = $(vLoop) to 60
I have tried with different combinations of Let and Set but none of them seems to work.
Let vLoop = 'Count(DISTINCT abc)'
Let vLoop = Count(DISTINCT abc)
Set vLoop = '=Count(DISTINCT abc)'
Set vLoop = 'Count(DISTINCT abc)'
Set vLoop = Count(DISTINCT abc)
Any ideas on what might I be doing wrong here.
Go to Solution.
You'll need to use the Peek function in the script to assign the value to the variable.
Try like this, after loading your initial table (let's say it's labeled T_Data):
Load count(distinct abc) as Cnt
let vLoop = peek('Cnt', 0, 'T_Count');
drop table T_Count;
for i = $(vLoop) to 60
is abc a field?
if yes try with
load * inline [
tmp: load count (distinct abc) as distinctabc resident t;
let v = peek('distinctabc');
for i = v to 60
Yes it was one of a field. Thanks your solution worked out.