on 05-12-2011 5:18 AM
Hi all visitors
I have created one crystal report and now i want to set the parameters to my report by using parameters in Crystal Report( the parameters not from sql).My parameters are datetime datatype. in my report, i create one formula( get date from DocDate field from sql).How can i set the default "Todate" parameter as current date?
Best Regards,
Just leave it blank in the defaults and it should show current date when you run report.
Ian
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Not as straight forward as I thought
In CR10 if you went to the Default button and left that dialog blank, when you run the report a date parameter was populated with current date.
However, with CR2008 leaving the Default blank when creating the parameter does not work the same way. When you run report date param is blank.
Try this
In 2008 Create a command to bring back current date
SQL server = select cast(getdate() as date)
Oracle = select trunc(sysdate)
In Parameter set up, use command as your source of parameter data.
Ian
Hi,
I generally do one of two things in these situations.
A) I create a default parameter that is not a realisitc date (IE Feb 1, 2000 for data that only started populating in 2005) then in the select expert I code using 'if, else, else if' statements to handle the that default date accordingly. If that date is changed then the non-default code is used. I generally use this tactic on reports that I run (not for end users).
B.) I create a parameter called (Use default Parmaeters) which is a Yes or No. If a Yes is selected then other parameters are ingored and default parameters are used (again in select expert) else the other parameters are used. I use this method on reports that users run as the first method can sometimes confuse users.
Good luck!
Hi,
So all of the seleciton is done using selecct expert. They have alot of default values there...but if you go to advanced then you can do much more still. So if you just want to only use the currentdate then you can just do something like
date({IT_ChangeManagement.Deployment Date/Time}) = currentdate
In the above case there would be no parameters needed and would show the currentdates information. You could of course do a varity of >= or <= using the above method.
If you want more flexability then you could create a parameter or two . Here is an example. This is again done in select expert....
if {?Start Date} <= date("01/01/2000") then
(
date({IT_ChangeManagement.Deployment Date/Time}) = currentdate
)
else
(
{IT_ChangeManagement.Deployment Date/Time} >= {?Start Date} and
{IT_ChangeManagement.Deployment Date/Time} <= {?End Date}
)
The above defaults to the current date if the start date is older than 2000, otherwise it uses the start & end date parmeters.
Make sense?
Rody, genius ...
B.) I create a parameter called (Use default Parameters) which is a Yes or No. If a Yes is selected then other parameters are ignored and default parameters are used (again in select expert) else the other parameters are used. I use this method on reports that users run as the first method can sometimes confuse users.
... excellent workaround.
Julie
hi,
If you want to see the current date as default date value in your parameter,
you could try creating a Prompt in Universe where you can specify the default value.
Pre-requisite : create an object in Universe which gets Current date from your DB.
Use this object as default value in your prompt syntax.
Pull this prompt into your query panel of Crystal report.
Now, when you run you will be able to see currentdate as default value in prompt.
Regards,
Vamsee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
79 | |
9 | |
9 | |
7 | |
7 | |
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.