Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have one small question, Peek(value) returns
returns the value of Value in the previous record read ( equivalent to previous(value) ).
Let's Assume
Name Value
A 10
B 20
C 30
D 40
E 50
If we take, Peek(Value) as Value1, Then how result is visible?
Name Value Values
A 10
B 20
C 30
D 40
E 50
Anil, I branched this to a separate thread since it is not a question related directly to the thread where you posted it.
I do not completely understand you question. Can you please provide a sample QVW file where Peek() returns unexpected values?
It is incorrect that Peek() and Previous() are equivalent functions. Please review the definitions in help, Peek ‒ QlikView and Previous ‒ QlikView, and consider the difference by for example applying the functions on your sample data.
LOAD
*,
Peek(Value) AS PeekValue,
Previous(Value) AS PrevValue
Inline [Name, Value
A, 10
B, 20
C, 30
D, 40
E, 50]
Where Name <> 'C';
Thanks,
I want to know how values are coming for value1 while using peek from my table?
I would suggest that you load the example script I added above. Then read the help pages, and reflect on what the example show you. Let me know if a result in that example does not make sense for you.
If you have an other example where the result do not turn up as you expected, please attach it so that we can explain why the result look the way they do.
Toni, First of all thanks.
For peek, It takes previous. But, I didn't understand why 30 will come?
Previous() operates on the Input to the Load statement, whereas Peek() operates on the Output of the Load statement. That is the reason you are getting 30.
There is a significant difference in the way Peek() and Previous() works.
Peek() is used to get a value from a in memory table, meaning data that has been processed and stored in the in-memory table. It can fetch the previous row stored, it can fetch data from any cell in any in-memory table.
Previous() is used to get a value from the record provided from the data source.
In my example Name C is not loaded into memory. The record is still fetched from the data source. For Name D the previous record is Name C, and its value is 30. The conclusion of this is that you need to chose the correct function depending on what you intention is. Are you looking for a value that has been stored, or are you looking for a value from previous incoming record?
Nie, Cool and cheers explanation.