0
votes

I am new to crystal reports.

Here is my data table "PAY_DETAILS".I need to display a "Basic Salary" field in my report. So I need to check whether the Earn_Type is "CBS" and if it is true then display the CBS amount in the report.How to write this formula.

 Amount          Earn_Type
--------------------------------
    6,789.00        ER006
    2,300.00        ER007
    7,890.00        ER009
    88.00           ER003
    88.00           ER004
    48,850.00       CBS
    8.00            ARS

I tried creating a formula field and drag it to report.But it displays nothing.Below is my formula.

numberVar salAmount  ;
if({PAY_DETAILS.EARN_TYPE}="CBS") then
salAmount= {PAY_DETAILS.AMOUNT};
1

1 Answers

0
votes

use := instead of equal when assigning a value

numberVar salAmount  ; 
if {PAY_DETAILS.EARN_TYPE} = "CBS" then
salAmount := {PAY_DETAILS.AMOUNT};