Search code examples
crystal-reportsformula

Crystal Report formula if-else statement Date condition


I would like to ask about how to use if-else statement in the crystal report formula.

I want something like

If Date = "01/01/1900" Then 
//Display "-" 
Else 
//Display Date

But i always faced that the field is require number, currency and date error. I am still new with crystal report. Hope u guys can guide me about this. Thank you


Solution

  • try

    if  totext((Date(Year(YourDateField), Month(YourDateField), Day(YourDateField))),'dd/MM/yyyy') ="01/01/1900" then
    "-" 
    else 
    totext((Date(Year(YourDateField), Month(YourDateField), Day(YourDateField))),'dd/MM/yyyy')