on 08-01-2017 12:02 AM
Hi all,
I am trying to create date default parameter be the first and last day of the previous month in Crystal Report XI to pull data automatically for the full previous month. Any advice would be greatly appreciated. Thanks in advance!
IIRC, XI r2 did not have the capability of setting default values for parameters or for making parameters optional. Does your report need to have parameters a user can enter or will the dates always be for the previous month?
If you do not need to have user-entered parameters, you can use {date field} InLastFullMonth in the selection formula to automatically give you the previous month's data.
Ian's suggestion for using a command is another way to do this. See this blog post for information about best practices for using commands - there's a lot of info in it about how to work with parameters in commands.
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alisia, I'm guessing you don't have a crystal reports server and therefore no repository. The old way was to add the
cdFirstDayOfMonth and cdLastDayOfMonth from the Repository Custom Functions to your report then reference this in your formula as
cdFirstDayOfMonth(DateAdd("m",-1,CurrentDate) to cdLastDayOfMonth(DateAdd("m",-1,CurrentDate)
You can try using DateAdd("m",-1,DateAdd("d", -Day(CurrentDate),CurrentDate))+1 to DateAdd("d", -Day(CurrentDate),CurrentDate)
- Rob
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Is this for a scheduled report or to speed up users data entry.
If report is based on a command you can add Variables to the report whereby if Parameter has a default value the variable are assigned the values you want.
Syntax depends on database.
Ian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.