I am currently working on a problem in which I want to look at the previous value of the row and which I can achieve by using Peek function. How can I look at the next value at the same time?
I want to be able to look at both at the same time. Please let me know if you need any more information. Greatly appreciate your help.
you can achieve this using the Peek function using its parameters like this:
peek( 'Sales',-1 ) - returns the value of Sales in the previous record read ( equivalent to previous(Sales) ).
peek( 'Sales', 1 ) - returns the value of Sales from the second record read from the current internal table.
Hope this helps.
Thank you for your response.
I m confused now. Would you please verify my two statements below?
If I am at row 1000,
Thank you very much for your help.
Here you have an example:
load * inline [
PREVIOUS(b) as PREV,
PEEK('b',RowNo(),'TABLE_AUX') as NEXT
DROP TABLE TABLE_AUX;
Please tell if this suits your needs.
I had the issue with log ordered by date (I wanted to compare the timestamp to the next). I find a simple solution was to order the table by Date desc;
if(Previous(id_objet)=id_objet, Previous(Date_et_heure)-Date_et_heure,0) as Duration,
Resident Fait_tmp order by id_objet,Date_et_heure desc;