Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Parameters in Crystal Reports 2011

Status
Not open for further replies.

src2

Technical User
Mar 1, 2001
72
0
0
US
I'm not sure if I described my subject correctly but here is what I'm trying to do. I am using Crystal Reports 2011 and I want to create a dynamic report where the user is prompted to enter a parameter that will be used for record selection. I would like to give options for the parameter to select either monthtodate, lastfullmonth, or a date range in a drop down list. If date range is selected the user is prompted to enter a starting and ending date. If the user selects monthtodate or lastfullmonth they aren't prompted for a starting and ending date.

Nothing I've tried so far works completely. Does anyone have any ideas or suggestions? Ultimately I'll be saving the report and viewing it in Crystal Corral which supports parameters.

Thanks in advance,

Steve
 

You won't be able to hide/show prompts based on the value of a previous prompt, but you can at least take advantage of optional parameters. Here's one way that is close to what you want.

Create static parameter 'Date Range', define as string, and hardcode these values into it:
Month To Date
Last Full Month
Custom Date Range

Disallow custom values and make Month to Date the default (or Last Full Month, whichever your users will select most).

Create another parameter 'Custom Date Range', define as date, and as range. Make this one optional.

Now when the user refreshes, they will see both prompts but if they leave prompt 1 as Month to Date, or change it to Last Full Month, then they don't have to enter anything in the date range fields. If they select Custom Date Range they will need to pick dates from the calendar controls, but they will not be required to do so.

You would probably want to be pretty explicit with the prompt descriptions so the user knows what to do the first time they use the report.




 
MonthToDate and LastFullMonth are actually commands, which Crystal Reports will interpret while date range is a set of 2 dates. You cannot combine different parameter types. However, both MonthToDate and LastFullMonth can be presented as dates and this is what I would do. If you use a viewer which supports default values you can try to manage this by setting the default values for the start and end date. This will allow you to handle also other scenarios without to change the report (YearToDate, PreviousYear, PreviousQuarter, Last Used Dates etc.). To give you an idea what I am talkng about check this video ( you can go directly to 1min 42sec, the end of this functionality is arround 2:46 ):


Viewer, scheduler and report manager for Crystal reports and SSRS.
Send your report everywhere.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top