Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
Is there an other method to display the previous and Next records
I create the previous BasePrice ans NextBase Price.
LOAD
ID,
BasePrice,
TotalAmount
FROM GetPreviousField.xls (biff, embedded labels, table is Sheet1$);
LEFT JOIN LOAD
*,
peek(BasePrice) AS NextBasePrice
RESIDENT Data ORDER BY ID DESC;
LEFT JOIN LOAD
*,
peek(BasePrice) AS PreviousBasePrice
RESIDENT Data ORDER BY ID ASC;
I think your basic approach using peek() and ordered input tables is fine.
Instead of the joins, you can use (and I would recommend that) ordinary LOADs, like
Data:
LOAD
ID,
BasePrice,
TotalAmount
FROM GetPreviousField.xls (biff, embedded labels, table is Sheet1$);
TMP:
LOAD
*,
peek(BasePrice) AS NextBasePrice
RESIDENT Data ORDER BY ID DESC;
RESULT:
LOAD
*,
peek(BasePrice) AS PreviousBasePrice
RESIDENT TMP ORDER BY ID ASC;
DROP TABLES Data, TMP;
I think your basic approach using peek() and ordered input tables is fine.
Instead of the joins, you can use (and I would recommend that) ordinary LOADs, like
Data:
LOAD
ID,
BasePrice,
TotalAmount
FROM GetPreviousField.xls (biff, embedded labels, table is Sheet1$);
TMP:
LOAD
*,
peek(BasePrice) AS NextBasePrice
RESIDENT Data ORDER BY ID DESC;
RESULT:
LOAD
*,
peek(BasePrice) AS PreviousBasePrice
RESIDENT TMP ORDER BY ID ASC;
DROP TABLES Data, TMP;
I think Previous may also be an option but Peek should work.
Thank you Suky.
Hi Swuehl,
Your approach is interesting, thank you.