sorting filerec before import

kabrocokabroco Member Posts: 111
Hello,

I have question about importing files.
How do I change the sequence of the files that are found? The files are sorted on the name.
I want the files to be sorted on date and time, oldest first.

FileRec.RESET;
//FileRec.SETCURRENTKEY(Date, Time); No possible, there is no key (and no real rec)
FileRec.ASCENDING(TRUE); //sorts on name

FileRec.SETRANGE(Path,PurchaseSetup."Filepath Scanfiles");
FileRec.SETRANGE("Is a file",TRUE);
IF FileRec.FIND('-') THEN
REPEAT
....

Is this possible?
Thanks.

Answers

  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    As you can't set a key on the Date-field in the virtual table File, you need to store all data in a temp-table. Then you can use SETCURRENTKEY on the temp-table recordvariable for sorting.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • kabrocokabroco Member Posts: 111
    To bad it is not possible.
    Thanks for the answer Luc.
    I already thought of that 'work-around'.

    Kabroco
Sign In or Register to comment.