Can't convert null to date

Posted by: ali.raza on 11 July 2023, 10:04 pm EST

    • Post Options:
    • Link

    Posted 11 July 2023, 10:04 pm EST

    I have this expression.

    Format(ToDateTime(date), “MM/dd/yyyy”

    But when I do not have any data for date, I get error, can’t convert null to date.

    Is there any way to control these warnings as they take time in report making.

    Thanks

  • Posted 13 July 2023, 12:40 pm EST

    Hi Ali,

    We tried using null dates along with your expression in our reports. However, the report seems to render as expected with the null values appearing as blank in the report preview. We have attached our sample to this response.

    If the issue persists could you please try sharing your sample report or modify our attached report such that it replicates the issue so we could further look into the same.

    Regards,

    Anand

    DemoReport.zip

  • Posted 13 July 2023, 4:21 pm EST

    Hello, our reports are generated although. We want to add a filter somehow so it does not show warnings in the console. Like isNothing() or something relevant. We tried adding them but did not work for us.

    Any help would be appreciated.

    Thanks.

  • Posted 16 July 2023, 5:01 pm EST

    Hi Ali,

    You can modify your expression and use an ‘IIF’ block to check if your date value is equal to ‘null’. If your date is equal to null you can return an empty string (or anything as per your requirement) else you can return your Date value.

    Please refer to the following expression:

    {IIF(orderDate = null, "Null", Format(ToDateTime(orderDate), "MM/dd/yyyy"))}
    

    We have attached a sample report implementing the same.

    Regards,

    Anand

    DemoReportUpdated.zip

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels