Zum Hauptinhalt gehen

How do I test for NULL values in reports?

Kommentare

1 Kommentar

  • Chris Dunlop
    Hi Mike.  I've done that by adding a script to the Script tab.  The string/numeric null/empty logic is a little convoluted, but basically it searches each value for a null, and if so, it replaces it with a 0.  This won't work if your fields are resolving coded domains (using the .name() method).  ANyway, hopefully enough to get you going.

     

    Chris

     

    public void ActiveReport_DataInitialize()

     

    {

     

     

     

        int numRows = (rpt.DataSource as DataSet).Tables[0].Rows.Count;

     

       for (int ii = 0; ii < numRows;ii++)

     

       { 

     

        if (   string.IsNullOrEmpty((rpt.DataSource as DataSet).Tables[0].Rows[ii]["UTILITIES_Water_Hydrants.HYG_INLT_SZ"].ToString())   )

     

        {

     

            (rpt.DataSource as DataSet).Tables[0].Rows[ii]["UTILITIES_Water_Hydrants.HYG_INLT_SZ"]=0; 

     

        }

     

       }

     

      rpt.DataSource = ((DataSet)rpt.DataSource).Tables[0].Select(null, "UTILITIES_Water_Hydrants.HYG_NUMBER ASC");

     

    }
    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.