Hi,
Would like to list all months between a start date and an end date.
For example say start date is january 2007 and end date december 2007,
would like to display all the months from january 2007 through december 2007.
Any ideas please!
](*,) ](*,) ](*,)
Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
0
Answers
UsedBeginDate := TODAY
UsedEndDate := CALCDATE('1Y',UsedBeginDate)
KSDate := UsedBeginDate;
REPEAT
KSDate := CALCDATE('1M',KSDate);
UNTIL KSDate > UsedEndDate;
Have tried your suggestion but it does not work. Only 02/01/2008 is displayed on the report. Below is my code:
gdat_Start := 010108D; // ***use any start date
gdat_End := 090108D; // ***use any end date
REPEAT
gtxt_Month := FORMAT(gdat_Start, 0, 4);
gtxt_Month := COPYSTR(gtxt_Month, 1, (STRPOS(gtxt_Month, ' ') - 1));
gtxt_Output := gtxt_Output + '\' + gtxt_Month;
gdat_Start := CALCDATE('+1M', gdat_Start);
UNTIL
gdat_Start > gdat_End;
MESSAGE(gtxt_Output);
I used the above code but it only display the starting month if gdat_Start is used in the section. I also used the gdat_End and it gives the end date too.
the ideas is to display all months between gdat_Start and gdat_End
How is the above code going to archeive this? Can you explain further maybe i don't understand it. Tell me what variable is going to be displayed.
Thanks
Any ideas.
Instead of using:
gtxt_Month := FORMAT(gdat_Start, 0, 4);
gtxt_Month := COPYSTR(gtxt_Month, 1, (STRPOS(gtxt_Month, ' ') - 1));
Use this instead:
gtxt_Month := FORMAT(TODAY,0,'<Month Text>'));
Having it display on a report instead of a message box should be easy after you get this part.
Have a look at my report maybe you can import it and try it on you database: Thanks.
Just filter on the following:
Period Type = Month
Period Start = 010107..123107
No complex calculation or programming required.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book
How can this work?
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
RIS Plus, LLC
Please can i see a sample code for this, Maybe i will see what i am not doing.
Go out, take a deep breath, smoke a cigarette, and come back with a fresh mind. It's just programming.
AP Commerce, Inc. = where I work
Getting Started with Dynamics NAV 2013 Application Development = my book
Implementing Microsoft Dynamics NAV - 3rd Edition = my 2nd book