cancel
Showing results for 
Search instead for 
Did you mean: 

DateTime Parameter in Crystal Report

Former Member
0 Kudos

hi,

in one of my crystal reports i'm invoking a procedure which has begin date and end date as parameters.when trying to run the report it's prompting for both date and time. my requirement is just to prompt for date and time is not required. the option of editing the parameter at the report level has been disabled since the parameters dierctly get invoked form procedure , in which i've declared the datatype as

samp_proc(p_begin_date date,p_end_date date,p_ref_cursor in out).

can someone help me on this.

Thanks,

Sailaja.k

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hi waterman,

i need to control the date in the procedure parameters itself rathe rthan in the body for which i cannot use a trunc function in the procedure parameters.

thanks,

Sailaja.k

Former Member
0 Kudos

hi abhilash,

thnx for the quick response . i tried the first step as suggested in your reply by creating a subreport and linking hte formulas with dateime conversion.

the parameters are being displayed as date alone but the results are not beign seen in the main report , but i'm able to see the result in the sub report.

Thanks,

Sailaja.k

abhilash_kumar
Active Contributor
0 Kudos

Hi Sailaja,

I'm not sure if this is a known issue or if this a bug, but there are workarounds.

Create a blank report and Insert the original report as a Subreport. Now in the Main report, create a Sttaic parameter of 'Date' type. Create a new Formula called 'Date_conv' and type this:

Datetime({?Date_parameter})

Place this formula on the Report Header and place the subreport on the Report Header too.

Right-click the subreport and select Change Subrpeort Links. Select the formula and move it to the Links to area. Next, from the drop-down on the bottom left select the datetime parameter of the subreport.

You may suppress all the other sections of the main report. The Report should now prompt for a 'Date' instead of the Date time.

Another workaround is by creating a registry key called useDateInsteadOfDateTime. Browse to HKEY_CURRENT_USER\Software\Business Objects\Suite 12.0\Crystal Reports\DatabaseOptions and create a string value called useDateInsteadOfDateTime. Set its value as the Database Server Name or the ODBC DSN name.

I would still recommend using the 1st workaround.

Hope this helps!

-Abhilash

Former Member
0 Kudos

If its a SP parameter then you must deal with it in the SP.

If Oracll you could try TRUNC() which converts datetime to date or SQL server 2008 use Cast(yourdatetimefield as date)

Ian