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: 
Tani
Contributor II
Contributor II

Conver script

Hi! Could you guys help me find a different way of writting this script:

RangeOfColor:
Load
Cod As Code,
From As FromDate,
To As ToDate,
Col As Color
From [xxx];

Set A= ;
For c = 0 to NoOfRows('RangeOfColor') - 1
Let Code = Peek('Code' ,c ,'RangeOfColor');
Let Color = Peek('Color' ,c ,'RangeOfColor');
Let FromDate = Peek('FromDate' ,c ,'RangeOfColor');
Let ToDate = Peek('ToDate' ,c ,'RangeOfColor');

Let A $(c) = Color;
If Len(A) = 0 Then
Let A = 'If(%Code=' & Code & ', ' & Color;
Else
Let C = C & ', If(%Code=' & Code& ', ' & Color;
End If

Labels (1)
2 Replies
Vegar
MVP
MVP

What's the issue with your current script?

Also: it's easier if you where able to provide a sample table and describe your desired output from that sample table.

Tani
Contributor II
Contributor II
Author

There is no issue with the script. I just need to find another way of writting what is in the If function.  The output of the code if giving different color for differen time periods in days. Meaning, if there are datas given from 0 - 5 days, 5 - 10 days or 10+ days. Can we use another loop, like for loop for example and how can we write it? Thanks 🙂