Testing for null values

5 posts, 0 answers
  1. Jorge
    Jorge avatar
    53 posts
    Member since:
    Jun 2009

    Posted 22 Jul 2009 Link to this post

    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!
  2. Janus Pedersen
    Janus Pedersen avatar
    34 posts
    Member since:
    Dec 2008

    Posted 30 Jul 2009 Link to this post

    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
  3. DevCraft banner
  4. msulis
    msulis avatar
    17 posts
    Member since:
    Apr 2007

    Posted 04 Feb 2010 Link to this post

    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) 

  5. Janus Pedersen
    Janus Pedersen avatar
    34 posts
    Member since:
    Dec 2008

    Posted 27 May 2010 Link to this post

    Hi
    Use use active Record
    and do it like this

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

    Janus S. Andersen


  6. Janus Pedersen
    Janus Pedersen avatar
    34 posts
    Member since:
    Dec 2008

    Posted 27 May 2010 Link to this post

    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
Back to Top
DevCraft banner