Sorting records in the Working Storage

Discussions about editing and cleaning data
Forum rules
New release: CSPro 8.0
Post Reply
AriSilva
Posts: 591
Joined: July 22nd, 2016, 3:55 pm

Sorting records in the Working Storage

Post 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?
Best
Ari
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: Sorting records in the Working Storage

Post 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.
Post Reply