Bug Report B200242
Visible to All Users

Report Datetime Parameter value set to current datetime on Null value

created 14 years ago

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.

Comments (1)

    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.

    Answers approved by DevExpress Support

    created 14 years ago (modified 13 years ago)

    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

      Show previous comments (5)
      Vasily (DevExpress Support) 10 years ago

        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?

          Vasily (DevExpress Support) 10 years ago

            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.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.