Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
avastani
Partner - Creator III
Partner - Creator III

how to view the next record in a resident table during load

I have loaded a table from a data source.

Now I want to perform some transformations whereby I need to know the value of the next record to add new fields. I know PEEK lets me go back, but is there anything that I can see 1 record ahead?

1 Solution

Accepted Solutions
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can look ahead using peek(). peek() row is 0 based and recno() is 1 based, so it's easy to look ahead one record like this:

data:
LOAD * INLINE [
X
A
B
C
]
;
data2:
LOAD
X,
peek('X', recno(), 'data') as Y
RESIDENT data
;


-Rob

View solution in original post

5 Replies
Not applicable

Order it the other way around and use Peek 🙂

avastani
Partner - Creator III
Partner - Creator III
Author

that's what i am trying but thought there must be a better way. i want to avoid multiple loads of the same table to be able to do one thing.

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can look ahead using peek(). peek() row is 0 based and recno() is 1 based, so it's easy to look ahead one record like this:

data:
LOAD * INLINE [
X
A
B
C
]
;
data2:
LOAD
X,
peek('X', recno(), 'data') as Y
RESIDENT data
;


-Rob

avastani
Partner - Creator III
Partner - Creator III
Author

that is it. i was playing around with it but didn't know how to use it. problem SOLVED! thanks.

Not applicable

I am trying the above code,

but it is really not working in my case

This is the excel table I created

ZC
3a
5b
4c
8d
7e

This the script

data:

LOAD Z,

     C,

     peek('Z',recno(),'data') as PEEK

In column PEEK  I end up with all fields marked with '-'

thank you!