on 12-16-2008 9:31 PM
I would like to generate the month (Decemeber) and year (2008) as part of the report header for a report that is generated once a month. I plan on subtracting 10 days from today just to give an accurate month and year since the report will always be run after the last day of the month, So on January 1, the report will be for December, 2008. Can anybody help with this. I am new to Crystal.
Great James!! but my year shows up as 2008.00
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
though this Question is answered , i would like to put forward one point
the formula
"Month: " + monthname(month(dateadd("m", -1, datadate))) + " / " +
"Year: " + totext(year(datadate), "####")
would not work in January month as it would return the current year i.e 2009 where as month returned would be December
the proper fomula would be to replace even datadate with dateadd("m", -1, datadate) so the final formula will be
"Month: " + monthname(month(dateadd("m", -1, datadate))) + " / " +
"Year: " + totext(year(dateadd("m", -1, datadate)), "####")
You are correct. Also my original idea was to subtract 10 days from todays date and pull the month and year from that date. This covers me in case the report is run in the same month that the data is for when I run the report. Any help on this? Alos, what does the "m" do in the formula? I thought it had something to do with month but it's used in your example to pull the year?
Edited by: John A Candidi on Dec 19, 2008 8:37 PM
Dear John ,
You can go for subtracting 10 days as well , but again it will have some limitation the report can't be run in the first 10 days of current month and after 11th in next month
if you are opting for 10 days logic, the formula would be
"Month: " + monthname(month(dateadd("d", -10, datadate))) + " / " +
"Year: " + totext(year(dateadd("d", -10, datadate)), "####")
here d represent days , [ m in previous formula does mean month only]
dateadd("d, -10 ,datadate) --> returns date subtracting 10 days from current date
dateadd("m, -1 ,datadate)--> returns date subtarcting 1 month from current date
year(date)--> returns the Year of Date passed to the function
but rather than hardcoding try to use parameter fields.explain ur scenario and lets see how can we make it better
Regard's
AGR
Create a formula such as:
//{@displaymonthandyear}
"Month: " + monthname(month(dateadd("m", -1, datadate))) + " / " +
"Year: " + totext(year(datadate))
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.