Discussion Board for collaboration related to QlikView App Development.
Can someone tell me why this isn't working?
RowNo() as CurrentRow,
RowNo() + 1 as NextRow
drop table OldTable;
Peek('Date', num#(NextRow)) AS NextRowDate
DROP TABLE temp;
I need to input on the current row a field telling me what is on a specific field on the next row. The 'NextRowDate' is showing a null value instead of the value of the field Date on the next Row.
Thanks in advance.
Go to Solution.
I think the reason it's no working is because peek() can work with either one parameter or three parameters, but not with two:
- Peek(Field) will give you the previous value of the Field in the current table
- Peek(Field, Row, Table) will give you the value of the Field from the specified Row in the specified Table.
In your example, you didn't specify the table, and that is likely the reason of the problem.
Having said that, I agree that the more intuitive solution is to sort the table in the descending order and retrieve the previous value, instead of the next value.
Upgrade your Qlik skills at the Masters Summit for Qlik - coming soon to Milan, Italy!
View solution in original post
I think to look into next row, I would do a sort in descending order and then use the regular way of doing the peek.
// test data
RecNo() as CurrentRow,
date(makedate(2014)+floor(rand()*1000)) as RefDate,
floor(rand()*10) as ContractNumber
// add next row e date
Left join (X)
previous(CurrentRow) as NextRow,
previous(RefDate) as NextRefDate
Order By ContractNumber, RefDate desc, CurrentRow;