| Author |
Message |
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|

Topic: Formula to get YYYYMM using current date Posted: 03 May 2016 at 2:15pm |
|
Hello,
Anyone know how to create a formula based on today's current date to get a list of YYYYMM format back to two years. So, use today's date in the formula to get:
201605 (current)
201604
201603
201602
201601
201512
201511
201510
201509
201508
201507
201506
201505
201504
201503
201502
201501
201412
201411
201410
201409
201408
201407
201406
201405
201404
201403
201402
201401
201312
201311
201310
201309
201308
201307
201306
201305
201304
201303
201302
201301
Thanks guys
|
IP Logged |
|
|
|
Valert16
Groupie
Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
|

Posted: 04 May 2016 at 7:32am |
|
This formula (CR syntax) will show a list of YYYYMM dates from now until 201301. You can modify the "While.. do" line if you need more or less items.
DateVar YearMonth := CurrentDate;
stringVar strYearMonth := ToText(CurrentDate, "yyyyMM");
While Not(Year(YearMonth) = Year(CurrentDate) -3 and Month(YearMonth) = 1) Do
(
YearMonth := CDate(DateAdd("m", -1, YearMonth));
strYearMonth := strYearMonth & Chr(13) & ToText(YearMonth, "yyyyMM");
);
strYearMonth
Hope it helps.
|
IP Logged |
|
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|

Posted: 09 May 2016 at 1:13pm |
|
Now, how do I insert it as a parameter? Thanks for your help
|
IP Logged |
|
Valert16
Groupie
Joined: 21 Mar 2016
Location: Spain
Online Status: Offline
Posts: 57
|

Posted: 10 May 2016 at 4:48am |
|
That seems a bit confusing. Can you clarify why do you need the formula with the list? Do you want to filter records?
A parameter consists of one or many values or that a user inputs before the report begins, so inserting a formula as a parameter doesn't have sense to me. Perhaps I am not able to guess what you are trying to do.
Please, can you explain in more detail what you want to do with the list?
|
IP Logged |
|
CrystalGirl
Newbie
Joined: 22 Feb 2015
Online Status: Offline
Posts: 36
|

Posted: 25 May 2016 at 9:47am |
|
Hi Valert16,
Yeah...sorry for the confusion. Please disregard my last question. I got the
Formula to do the year period YYYYMM and that is enough. Thanks again all!
|
IP Logged |
|
|
|