Skip to Content
avatar image
Former Member

Crystal Reports formula

I am new to Crystal Reports and am learning as I go. I am working on a formula that will leave me a date or if the second date field is empty(Null) then I can have it leave a word of my choice like "OPEN" I can't seem to get the two statements to work together.

{hosp_crisis_admit.discharge_date}-{hosp_crisis_admit.admit_agency_start_date}
IF IsNull({hosp_crisis_admit.discharge_date})=true then "TEST"

CR 2013 SP1

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Nov 30, 2017 at 03:33 PM

    what is your formula? what you pasted will not work

    {hosp_crisis_admit.discharge_date}-{hosp_crisis_admit.admit_agency_start_date}
    IF IsNull({hosp_crisis_admit.discharge_date})=true then "TEST"
    What did you want this to do? It is not clear from your question

    This on its own will work
    IF IsNull({hosp_crisis_admit.discharge_date})=true then "TEST"

    Ian

    Add comment
    10|10000 characters needed characters exceeded

  • Dec 05, 2017 at 08:34 AM

    Hi Steve,

    Create a formula with this code:

    IF {hosp_crisis_admit.discharge_date} = date(0,0,0) THEN 'OPEN'
    Else totext({hosp_crisis_admit.admit_agency_start_date} - {hosp_crisis_admit.discharge_date},'#')

    In the formula editor, look for a drop-down on the top called 'Exceptions for Nulls'; change that to 'Default Values for Nulls'

    Save the formula.

    -Abhilash

    Add comment
    10|10000 characters needed characters exceeded