I am creating an application with a report in VB .NET. I have all the data showing up and now I need to create a summary at the bottom of the report to show current, Month To Date, and Year To Date information for formulas and database entries. I have it working to a point. My question is what is the format to write a formula for these two fields to keep the data current even if I am not working in the current month. If I am doing November data it seems to work, but if my date is in October I am not getting the data for October, I am still getting November data. I looked in the Crystal Help file and they suggest to change the date on the computer in the control panel. hmmm.... Not very professional if you ask me. Any help would be great.Look under Report menu in Crystal - you can change the date (last option is "Set Report Print Date/Time").
Change that date and MonthToDate etc will use it for their dependent calculations.
Check the object model under .NET and hopefully that property is exposed and is able to be modified by your .NET code.
dave|||Dave,
Thank you for the reply. I have tried that, but I am still having problems. I can get the current data to show up in the MTD formula but it is not adding it the the previous data for the month. I am sure it is a placement problem but I could be worng there. I am also not getting an accurate sum for a formula that is a division problem. I have ordered a new book to help, but any input you may have would be great. Thank you.
Julie|||Hi Julie,
Here's what I would do:
You know you can create more than one group based on the same report field? Well, you can.
So, say you already have a group to show details date by date, create a group above this based on the same field, but in the "Change Group" options, set the "for each section" option to select 'for each year'.
That will give you a section that will show summary data based on the whole year.
Add another group based on the date, and in the "Change Group" options, set the "for each section" option to select 'for each month'.
The groups may not be in the order you want, so use Report menu, and then Change Group Expert, to define the order:
Should be Group 1 : year
Group 2 : month
Group 3 : day
then create your summaries.
Now in the case of one of my reports, I want data from the current month, even though it's incomplete, so in my report formula for selection by line (Report menu, Edit Selection Formula, Record...)
I use something like this:
(({DATEFIELD} > DateAdd("m", -12, {?Pm-?ReportDate})
and
{DATEFIELD} <= {?Pm-?ReportDate}).
Just bear in mind that if date is 15/12/04, report then goes back to 16/12/03.
IF you want completed months then you need a formula field first, something like this (we'll call it EndDate):
' get first day of current month.
formula = DateValue(Year(CurrentDate), Month(CurrentDate), 1
Then in my record selection formula I'd do this:
(({DATEFIELD} >= DateAdd("m", -12, {@.EndDate})
and
{DATEFIELD} < {@.EndDate}). ' note less than, because must be less than first of current month.........
Hope this helps
dave
Monday, March 26, 2012
monthtodate and yeartodate
Labels:
application,
create,
creating,
database,
microsoft,
monthtodate,
mysql,
net,
oracle,
report,
server,
showing,
sql,
summary,
yeartodate
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment