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

Stimulsoft Reports.NET discussion
Post Reply
ptabkra
Posts: 27
Joined: Tue Oct 16, 2007 10:33 pm

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

Post 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.




Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

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

Post 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.
ptabkra
Posts: 27
Joined: Tue Oct 16, 2007 10:33 pm

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

Post 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
Post Reply