cancel
Showing results for 
Search instead for 
Did you mean: 

need help to create Formula Fields

Former Member
0 Kudos

I'm a Crystal Report Beginner

My datasource as following,

My design as following,

I want to create Formula Fields as following

  1. Earning
  2. Deduction
  3. Nett

To calculate Earning is edtype=01. As a result, Earning= 50.00

To calculate Deduction is dtype=02. As a result, Deduction= 8.00

To calculate Nett is Earning - Deduction. As a result, Nett= 48.00

How to create the Formula Fields as following

  1. Earning
  2. Deduction
  3. Nett

Please help me

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sharul Nizam,

I think the 'edtype' and 'edamount' are the 2 fields that are involved in the calculation.

Both seem to be placed on the 'Details' section in the report design.

If that is the case, then you can do this by writing 3 formulas:

1. 1st formula - "Calculate E And D"- Place this in 'Details' section and suppress.

Whileprintingrecords;

numbervar earning;

numbervar deduction;

if {edtype}=01 then earning:= earning + {edamount}

elseif {edtype}=02 then deduction:= deduction + {edamount}

else 0;

2. 2nd formula- "Display Nett": Place this in Group Footer

Whileprintingrecords;

numbervar earning;

numbervar deduction;

earning-deduction;

3. 3rd formula- Reset E And D"- Place this in Group Header and suppress

Whileprintingrecords;

numbervar earning:= 0;

numbervar deduction:=0;

Please keep this forum thread updated with the results.

Thanks,

Prathamesh

Former Member
0 Kudos

tq sir

Answers (0)