Search code examples
crystal-reports

Create a formula


I placed my field ParentDied from table tblSIF onto my page report. If the report loads, the condition should be:

 IF ParentDied = 0 THEN 'None' ELSE 'Deceased'

I searched on the Internet and found this:

`IF {@Ship Days} = 0 THEN "Same Day" ELSE {@Ship Days}`

Where did @Ship come from? Is that a parameter? All I know is that the field is named by CR as tblSIF.ParentDied. How can I make a formula of my own?


Solution

  • To create and use a formula on your report follow these steps:

    1. Right Click Formula Fields and select New...

      enter image description here

    2. Input a name for your formula

      enter image description here

    3. In the Formula Workshop add in your expression

      enter image description here

      Based on your example this will be something like:

      If {tblSIF.ParentDied} = 0 Then "None" Else "Deceased" 
      
    4. Drag the report onto the report to display

      Design:

      enter image description here

      Preview:

      enter image description here