home *** CD-ROM | disk | FTP | other *** search
- PROGRAM SortDemo;
- {TPDB Version 3.14}
- {Copyright 1991 Brian Corll}
-
- Uses Crt,TPDB,TPDBSort,TPDBStr;
-
-
- {Declare a FAR function which creates the sort key expression.}
- {This function MUST call the SortFile object, as shown.}
- {$F+}
- FUNCTION MakeKey : DBKey;{This function MUST return the type DBKey !}
- BEGIN
- MakeKey := Substr(For2Eng(SortFile^.Field(1),ForTable,EngTable),1,1);
- END;
- {$F-}
-
- BEGIN
- Writeln('Sorting TEST.DBF to SORT.DBF....');
- {Set the VAR SortFunc equal to the sort key function.}
- SortFunc := MakeKey;
- {Then call the sort with the SortFunc VAR and the input and output files.}
- SortOn(SortFunc,'test.dbf','sort.dbf');
- Writeln('Sort complete !');
- END.