Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi guys,
i'm in trouble because i notice that Peek() don't work with Preceding load and i don't know why.
Load
If(COUNT=Peek(COUNT),Peek(PROG)+1,1) as PROG,
*
Where Len(Trim(CODE))>0;
The output i want is the following: for every COUNT a numerical sequence (PROG) if the CODE>0.
Now, all the PROG=1.
What's my mistake?
Thanks,
Mattia
Hi Mattia,
I didn't understand your question very well, maybe with an example I can understand it well.
otherwise Peek() in Qlik: finds the value of a field in a table for a row that has already been loaded or that exists in internal memory.
while in your function you use If(COUNT=Peek(COUNT),Peek(PROG)+1,1) as PROG
so you test on a value that is not yet loaded in memory "COUNT=Peek(COUNT)".
think about using "Resident".
I hope this will help you.
Taoufiq
Hi Mattia,
What you've written down is a code that identifies if the previous row is the same number.
For this to work properly, you may want to order your data by the column [COUNT] like this:
(script below is plug-and-play)
TestData:
Load * INLINE [
COUNT
101
102
103
103
104
105
105
105
106
];
Transformed:
NoConcatenate
Load
If(COUNT=Peek(COUNT), Peek(PROG)+1,1) as PROG,
COUNT
Resident TestData
ORDER BY COUNT ASC
;
DROP TABLE TestData;
Results:
Keep in mind, if you only get 1's - you can check if you have only unique values in the column COUNT.
I hope that helps!
Kind regards,
S.T.
Hi guys and thanks for the suggests.
I'm sorry but i'm not able to solve this problem.
If you can, the original problem is the following:
Please, help me!!!
Thanks,
Mattia
@Mattia Hi, it seems the post your linking to has been deleted, please provide the needed details. Thank you