Is there a way for me to limit my array by the date of the file? I am wanting all the files from the drive but only if the date on the file is > the last stored import datetime. When I build the array on "asterisk.asterisk" it takes too long. Any thoughts?
fsLAST = ''
USE CMEMAILS IN 0
SELECT CMEMAILS
SET ORDER TO DTSTAMP && DTSTAMP
GO BOTTOM
fsLAST = CMEMAILS.DTSTAMP
local array MyFiles[1,5]
nFilesFound = ADIR( MyFiles, ALLTRIM(cmcontrol.cpath) + '*.*')
for i = 1 to nFilesFound
SELECT cmemails
DO CASE
CASE DATETIME(YEAR(MyFiles[ i, 3]), MONTH(MyFiles[ i, 3]), DAY(MyFiles[ i, 3]), VAL(LEFT(MyFiles[ i, 4], 2)), VAL(SUBS(MyFiles[ i, 4], 4, 2)), VAL(SUBS(MyFiles[ i, 4],7,2))) > fsLAST
insert into cmemails (cprimary, csubject, ddate, dtime, cattribs, dtstamp) values ;
(generateGuid(26), MyFiles[ i, 1], MyFiles[ i, 3], MyFiles[ i, 4], MyFiles[ i, 5],DATETIME(YEAR(MyFiles[ i, 3]), MONTH(MyFiles[ i, 3]), DAY(MyFiles[ i, 3]), VAL(LEFT(MyFiles[ i, 4], 2)), VAL(SUBS(MyFiles[ i, 4], 4, 2)), VAL(SUBS(MyFiles[ i, 4],7,2))) )
ENDCASE
endfor