At runtime when assign null value to report parameter value with datetime type system set it to current datetime instead of null. So report is printed with current datetime instead of blank.
Report Datetime Parameter value set to current datetime on Null value
Answers approved by DevExpress Support
Hi Vinh,
We have examined this issue and come to the conclusion that the current behavior is by design. When parameter value is null, its value is reset to the default value. The default value for the DateTime is the current DateTime. To avoid this problem, you can register a custom object parameter type. Its default value is null. Finally, you will be able to substitute the default parameters editor using the ReportDesignExtension Class descendant. Attached is a sample project, illustrating this approach in action. Please let us know whether or not the problem still persists.
Thanks,
Sergi
Hi Johan,
I am happy to hear that you have managed to accomplish this task. Thank you for sharing your solution with us.
Hello,
To be able to pass null datetime value in ParametersRequestBeforeShow event of the report I did like this:
this.Parameters["parameter1"].Type = typeof(DateTime?);
this.Parameters["parameter1"].Value = null;
this.Parameters["parameter2"].Type = typeof(DateTime?);
this.Parameters["parameter2"].Value = null;
But this way date parameter field looses it's pick up date ability. Date field turns into text field. How leave this field as date field?
Hello Vugar,
To process your recent post more efficiently, I created a separate ticket on your behalf: T293601: How to use nullable Datetime Parameter in the report. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
When assign value to report parameter when non null value encounter. It will print 01/0001 if no value assigned to the report parameter. The xrlabel on report has the MM/yyyy format.
I don't know at what DevExpress version this behavior has changed but it should display blank. This does not happen with regular data that bind to report thru bindingsource only report parameter.