Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you conditionalize the ADIR() command?

Status
Not open for further replies.

Quickbuzz

Programmer
Oct 24, 2013
1
US
Can you conditionalize the ADIR() command? I want to be able to limit the ADIR() to the dates of the files.

Code:
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) + '*.*')
	qazwsx = 0
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
 
No.

But since the third column of the resulting array is the file date it's easy enough to have your processing code skip rows based on a date.
 
Follow this link for documentation about ADIR():


You might also investigate DTOC():


and other date functions:


mmerlinn


Poor people do not hire employees. If you soak the rich, who are you going to work for?

"We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding. Answering questions for careless and sloppy thinkers is not rewarding." - Eric Raymond
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top