-Preston
static void pl_scratch(Args _args)
{
str dateRange = '2003-10-13..2003-10-17,2003-09-15,2003-08-15,';
boolean firstLoop = true;
int dblDots;
int start;
int end;
int sLen;
int incomingDateFormat = 321;
int outputDateFormat = 213;
str subString;
date startDateRange;
date endDateRange;
int rangeCnt;
;
sLen = strlen(dateRange);
do{
subString = '';
start = end+1;
end =strFind(dateRange, ',', start, firstLoop ? sLen: sLen-start);
subString = strRTrim(strLTrim(subStr(dateRange,start, end ? end-start: sLen -
start)));
dblDots = strFind(subString, '..', 1,strLen(subString));
if(dblDots){
startDateRange = str2Date(strRTrim(strLTrim(subStr(subString, 1,
dblDots-1))), incomingDateFormat);
endDateRange = str2Date(strRTrim(strLTrim(subStr(subString, dblDots+2,
strLen(subString)-dblDots+2))), incomingDateFormat);
rangeCnt = 0;
while(rangeCnt < (EndDateRange-startDateRange)){
startDateRange += rangeCnt;
info(date2str(startDateRange,outPutDateFormat, 2, 4, 2, 4, 4));
++rangeCnt;
}}
info(date2str(str2Date(subString, incomingDateFormat),outPutDateFormat, 2, 4, 2, 4, 4));
firstLoop = false;
} while(end);
}
-----Original Message-----
From: Steeve Gilbert [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 3:13 PM
To: [EMAIL PROTECTED]
Subject: RE : [development-axapta] Re: Select date range
That's not really what I was looking for but it does help, and will probably be useful in the future, thanks!
Steeve...
-----Message d'origine-----
De : henriktonnesen [mailto:[EMAIL PROTECTED] Envoyé : 16 septembre, 2003 12:34
À : [EMAIL PROTECTED]
Objet : [development-axapta] Re: Select date range
This might help
QueryBuildDataSource qbds; QueryBuildRange qbr; Query q; QueryRun qr;
q = new Query();
qbds = q.addDataSource(tablenum(InventTrans));
qbr = qbds.addRange(fieldnum(InventTrans,DateFinancial));
qbr.value('16-09-2003..18-09-2003,02-09-2003..05-09-2003,12-08-
2003');
info(qbds.toString());
The qbds.toString() returns a "sql-statement" with
(DateFinancial>=16-09-2003 AND DateFinancial<=18-09-2003 OR DateFinancial>=02-09-2003 AND DateFinancial<=05-09-2003 OR DateFinancial = 12-08-2003) which need a little parsing.
Good luck
--- In [EMAIL PROTECTED], "Steeve Gilbert" <[EMAIL PROTECTED]> wrote:
Hi all!date
Let's say a date range entered by the user like
"2003-10-13..2003-10-17, 2003-09-16" or anything that is a valid
possiblerange. I want to be able to get a list of all the dates that are included by this range.
Some weird way would be to select a table that contains all
dates and restrain it with this range, then I would get a list ofall
the date included by this range. But I don't think that such atable
exist.
Do you know a way to achieve this?
Steeve...
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
Yahoo! Groups Sponsor ADVERTISEMENT
click here
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

