Durga
Durga

Reputation: 1303

How to add formula on Crystal report fields

Below is my crystal report ,I want to perform Formula something like below ,as I am new to crystal report how can I do this ?

if (`Fee_unit`==Percent)
{
FeeTotal = (`Fee` divided by 100) * `Number of patients`;
}
else
{
FeeTotal = `Fee` *  `Number of patients`;
}

Crystal report

Upvotes: 1

Views: 16466

Answers (1)

user240141
user240141

Reputation:

In Field Explorer -> Formula-> New Formula.

From the drop down above select Basic Syntax.

If {TableName.FeeUnit} = {TableName.Percent} Then // Assuming you have FeeUni and Percent as column in TableName table. Drag drop the two and wrap with the code
    formula=({TableName.Fee}/100)*{TableName.Patients}  // formula here is a keyword

Else 
    formula={TableName.Fee}*{TableName.Patients}  
End If

Upvotes: 2

Related Questions