>Create Cursor MyCursor >FileList=adir(SmallTable_xx.dbf) > >For each SmallTable in FileList > Extract useful data from SmallTable > Insert the data into the Cursor &&such that no need to sort afterward >Endfor >>
Create Cursor MyCursor (yourfieldname1 type precision, ...) ADIR(FileList, 'SmallTable_*.dbf') *-- ALEN() will give you the row count of the array fileList For x=1 to ALEN(FileList,1) *-- Open the table in an unused work area USE FileList[x,1] IN 0 *-- Extract your data SELECT yourFields FROM (FileList[x,1]) WHERE yourSelectCondition INTO ARRAY dataArray *-- Insert the data into the Cursor INSERT INTO DBF('MyCursor') FROM ARRAY dataArray *-- Close files and clean up USE IN (FileList[x,1]) RELEASE dataArray EndforRegarding the sort order, you could sort MyCursor after all inserts are finished. You will not be able to sort while inserts are going on since you cannot 'insert before' a record.