Page 1 of 1

Equivalent value for a NULL DateTime Data type (on ConvertNull Property = true)

Posted: Mon Jan 14, 2008 9:19 pm
by ptabkra
Hi, when a data (of type DateTime) is null, what is its Stimulsoft Report Tool equivalent? I understand that for number values -- it sets to 0 given that property ConvertNull = True.

I needed your advise on this since I got an error for this situation: I am trying to create a BeforePrint condition so that FooterDates.Enabled = false whenever OrderInstrum.CommencementDate is null.

I used this:

if (dspaymentCertificateForm.COMMENCEMENTDATE.Equals(null))
FooterDates.Enabled = false;

But I got this error:
Method: [get_COMMENCEMENTDATE] Object reference not set to an instance of an object.

Please advise what can I do about this.

Thanks in advance.





Equivalent value for a NULL DateTime Data type (on ConvertNull Property = true)

Posted: Tue Jan 15, 2008 2:58 am
by Edward
Please modify your code in the following way:

Code: Select all

if (dspaymentCertificateForm["COMMENCEMENTDATE"] is System.DBNull)
FooterDates.Enabled = false;
Also about this kind of checking you can read more here:

http://www.stimulsoft.com/Documentation ... riable.htm

Thank you.

Equivalent value for a NULL DateTime Data type (on ConvertNull Property = true)

Posted: Thu Jan 17, 2008 8:45 pm
by ptabkra
Thanks Edward. I just came back to check the reply today. Anyway, I was able to use this after browsing on some related forum topics:

if( dspaymentCertificateForm["COMMENCEMENTDATE"] == DBNull.Value & dspaymentCertificateForm["COMPLETIONDATE"] == DBNull.Value )
FooterDates.Enabled = false;

Now I would love to try the code you suggested. (Taking it from the expert) :biggrin:

Cheers*
Karen