This is a migrated thread and some comments may be shown as answers.

Testing for null values

4 Answers 3495 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jorge
Top achievements
Rank 1
Jorge asked on 22 Jul 2009, 01:33 PM
Testing a field for null value does not work with Q2 2009 and SQL Server.
I tried
=IIf(Fields.myField = Null, "Some text " + Fields.myField, "N/A") 
and I always get "N/A" even when Field.myField is not null.

Any idea?
Thanks!

4 Answers, 1 is accepted

Sort by
0
Janus Pedersen
Top achievements
Rank 2
answered on 30 Jul 2009, 11:02 PM
It is true. It is smarter to do the chek in SQL, it will work. Else find the value that the TextBox give your when the data is null and use the Conditional Formating Rules designer. I have done it both ways and It is working. But the best way is to do the chek in SQL in DB.

Janus S. Andersen
Denmark
1
msulis
Top achievements
Rank 1
answered on 04 Feb 2010, 11:27 PM
use the "IS" comparison to check for Null, just like you would in SQL. It took me a while to stumble on this, so I think it's worth adding to this thread...

=Iif(Fields.MyField IS Null,"NA",Fields.MyField) 

0
Janus Pedersen
Top achievements
Rank 2
answered on 27 May 2010, 02:14 PM
Hi
Use use active Record
and do it like this

 if (eftersynMain.EftersynKopieretTekst != null)
 {
// Do somthing
}

Janus S. Andersen


0
Janus Pedersen
Top achievements
Rank 2
answered on 27 May 2010, 02:19 PM
Else use the default value of the feild type in the Telerik. Reporting like the date type have a default value if the value is not valid.

In new report I use the coalesce function in the SQL part. See http://en.wikipedia.org/wiki/Null_%28SQL%29 for help

Janus S. Andersen
Denmark
Tags
General Discussions
Asked by
Jorge
Top achievements
Rank 1
Answers by
Janus Pedersen
Top achievements
Rank 2
msulis
Top achievements
Rank 1
Share this question
or