intyear := DATE2DMY(TODAY,3); FOR Counter := 1 TO 12 DO BEGIN datstartdate[Counter] := DMY2DATE(1,Counter,intyear); datenddate[Counter] := CALCDATE('<+1M-1D>',datstartdate[Counter]); "Trans. Sales Entry".SETRANGE("date",datstartdate[Counter],datenddate[Counter]); netamount[Counter] := "Trans. Sales Entry"."Net Amount"; grossamount[Counter] := "Trans. Sales Entry"."Gross Amount"; qty[Counter] := "Trans. Sales Entry".Quantity; END;
Comments
You need to do a FIND after the SETRANGE statement.
Thanks for the quick reply.
I'm trying ro reference:
"Trans. Sales Entry"."Net Amount";
"Trans. Sales Entry"."Gross Amount";
"Trans. Sales Entry".Quantity;
With the monthly date filter applied.
The following manual code does filter correctly for Jan.
thanks
I am supposing that there is only one record in "Trans. Sales Entry" per date range?
Have u tried to put a
before applying any other date filters?
bye.
No there are tens of thousands of entries per date range.
I'm a little confused, wouldn't the run through each record in "Trans. Sales entry" per date range?
Cletenaff, I tried your suggestion but it made no difference.
thanks
Not unless you have got some sumindexfields setup, no, it's simply giving you 12 iterations.
That would use each record within the date range.
I think. 8-[
1. Create key Date in "Trans. Sales Entry" with SumIndexFields "Net Amount", "Gross Amount" and Quantity
2. Insert "Trans. Sales Entry".CALCSUMS("Net Amount", "Gross Amount", Quantity); after your setrange command
Yes, that would be faster, but I think that it's important for him to know why his loop would not work on its own.
Lubost, I've never used sumindexfields. (Never created flow fields etc)
How would I go about 'coding' it.
many thanks
instead of where you currently have the SETRANGE command. So, something like this:
instead of where you currently have the SETRANGE command. So, something like this:
Whoops, sorry, I hit quote instead of edit.