Page 1 of 1

Display custom text when a column value is null

Posted: Mon Mar 25, 2013 9:21 pm
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?

Re: Display custom text when a column value is null

Posted: Tue Mar 26, 2013 5:55 am
by Alex K.
Hello,

Please check the following expression:

Code: Select all

Employee["dateCreated"] == DBNull.Value
Thank you.

Re: Display custom text when a column value is null

Posted: Tue Mar 26, 2013 9:09 pm
by Chris Trueblood
Thanks very much. This worked:

Code: Select all

{(Employee["dateCreated"] == DBNull.Value) ? "No Date Created Defined" : Employee["dateCreated"]}

Re: Display custom text when a column value is null

Posted: Wed Mar 27, 2013 5:46 am
by Alex K.
Hello,

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

Thank you.