cancel
Showing results for 
Search instead for 
Did you mean: 

Try This And See If You Get Any Results From The Code In The Question

Former Member
0 Kudos

Would someone try the below code and see if 9/9/1999 shows up. "{TableName.Sales_Date}" is a date-time field ? Thanks ! ! !

If {Sales_Primary.Type_Of_Sale} = 1 And

Isnull({TableName.Sales_Date}) Then #9/9/1999#

Else

{TableName.Sales_Date};

Accepted Solutions (1)

Accepted Solutions (1)

former_member292966
Active Contributor
0 Kudos

Hi Lenell,

Try this instead:

If {Sales_Primary.Type_Of_Sale} = 1 And

Isnull({TableName.Sales_Date}) Then Date (1999, 9, 9)

Else

{TableName.Sales_Date};

Also go to File | Report Options and see if you have Convert Database Null Values to Default and Convert Other Null Values to Default turned on.

If these are on then try:

If {Sales_Primary.Type_Of_Sale} = 1 And

{TableName.Sales_Date} = Date (0,0,0) Then Date (1999, 9, 9)

Else

{TableName.Sales_Date};

Most likely it's how Crystal is handling the NULLs that's the problem.

Good luck,

Brian

Answers (2)

Answers (2)

Former Member
0 Kudos

Raghavendra,

Did not work . . . nothing placed in the field.

Former Member
0 Kudos

Brian,

That did it . . . Thanks ! ! ! If I wanted insert "Date Missing" instead of '9/9/1999', Is this possible with a date field ?

Former Member
0 Kudos

If you want to get "Date Missing" then you need to convert the field to totext() in else condition because If statement will work only when the retun type is same datatype.

Try the following

If {Sales_Primary.Type_Of_Sale} = 1 And

Isnull({TableName.Sales_Date}) Then "Date Missing"

Else

totext({TableName.Sales_Date});

Regards,

Raghavendra