Display custom text when a column value is null

Stimulsoft Reports.NET discussion
Post Reply
Chris Trueblood
Posts: 2
Joined: Mon Mar 25, 2013 9:11 pm

Display custom text when a column value is null

Post by Chris Trueblood »

When a column value is null, I need to display text such as "No Date Created Defined". I have tried supplying this expression:

Code: Select all

{(Employee.dateCreated == null) ? "No Date Created Defined" : Employee.dateCreated} 
{IIF((Employee.dateCreated == null),"No Date Created Defined",Employee.dateCreated)}
However I then get this error:

Code: Select all

Operator '+' cannot be applied to operands of type 'System.DateTime' and 'object'.
What is the preferred way to customize the display value for null values?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Display custom text when a column value is null

Post by Alex K. »

Hello,

Please check the following expression:

Code: Select all

Employee["dateCreated"] == DBNull.Value
Thank you.
Chris Trueblood
Posts: 2
Joined: Mon Mar 25, 2013 9:11 pm

Re: Display custom text when a column value is null

Post by Chris Trueblood »

Thanks very much. This worked:

Code: Select all

{(Employee["dateCreated"] == DBNull.Value) ? "No Date Created Defined" : Employee["dateCreated"]}
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: Display custom text when a column value is null

Post by Alex K. »

Hello,

We are always glad to help you!
Let us know if you need any additional help.

Thank you.
Post Reply