Sort TEMP-TABLE

subscripciones

New Member
DEF TEMP-TABLE test
FIELD caption AS CHARACTER.

create test.
assign test.caption = "Microsoft".
create test.
assign test.caption = "Apple".
create test.
assign test.caption = "Oracle".

FOR EACH test no-lock.
DISPLAY test.caption.
END.

it's possible to sort a temp table?

output:

Apple
Microsoft
Oracle


Thanks
 
FOR EACH test no-lock BY test.caption.
DISPLAY test.caption.
END.

Is that what you were looking for? You can also nest BY statements.

Edit: In bold
 
If you want to sort a temp-table, define an index for it. With three records you probably won't notice much difference, but with 10,000 you probably will. With the desired sort order as the primary index, you wouldn't even need the BY clause, but I would put it in as good documentation anyway.
 
Back
Top