Page 1 of 1

Sorting records in the Working Storage

Posted: May 6th, 2018, 5:16 pm
by AriSilva
I defined a WS with an only record occurring 100 times.
I started clearing the WS, but what I really wanted was the empty the records, that is, having no records at all.
Apparently they cannot be emptied, because when I move some values to the first, second, third records, etc, and then, when I sort the WS,
sort(WS_REC using WS01_DIASETOR);
it sorts the records, but puts the blank ones at the head of the list.
Is there a way to start the WS with no records in order to be able to use the sort function?

Re: Sorting records in the Working Storage

Posted: May 6th, 2018, 8:39 pm
by josh
Try deleting the extra records using the delete function. Something like:
do varying numeric i = count(WS_DICT.WS_REC) until i <= 0 by (-1)
    
delete (WS_REC(i));
enddo;
If that doesn't work you will have to look for a different approach. In the past I have just added a roster on a form that I don't show and used that instead of working storage since the occurrence functions behave better when there is a roster on a form.