I have a date column "dt" that can accept nulls. I want to create a calculated bool column that returns true if the date is less than today, or false otherwise.
The formula is:
(MyTable.dt < DateTime.Now)?true:false
This almost works ... but of the date value is a NULL, then the formula returns a null as well. What is the easiest way to write a formula for this ... I could manually check for a null but that makes the formula really complex:
(IsNull(MyTable,"dt2))?true:((MyTable.dt < DateTime.Now)?true:false)
Calculated column using date column
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Calculated column using date column
Hello.
[quote="jay"@bplogix.com]I have a date column "dt" that can accept nulls. I want to create a calculated bool column that returns true if the date is less than today, or false otherwise.
The formula is:
(MyTable.dt < DateTime.Now)?true:false
This almost works ... but of the date value is a NULL, then the formula returns a null as well. What is the easiest way to write a formula for this ... I could manually check for a null but that makes the formula really complex:
(IsNull(MyTable,"dt2))?true:((MyTable.dt < DateTime.Now)?true:false)
[/quote]
Please, try to use next expression
Thank you.
[quote="jay"@bplogix.com]I have a date column "dt" that can accept nulls. I want to create a calculated bool column that returns true if the date is less than today, or false otherwise.
The formula is:
(MyTable.dt < DateTime.Now)?true:false
This almost works ... but of the date value is a NULL, then the formula returns a null as well. What is the easiest way to write a formula for this ... I could manually check for a null but that makes the formula really complex:
(IsNull(MyTable,"dt2))?true:((MyTable.dt < DateTime.Now)?true:false)
[/quote]
Please, try to use next expression
Code: Select all
(MyTable.dt < DateTime.Now || IsNull(MyTable,"dt"))?true:false