如何在Crystal报表字段中添加公式

时间:2013-10-06 15:12:34

标签: c# crystal-reports

以下是我的水晶报告,我想执行下面的公式,因为我是水晶报道的新手,我该怎么做?

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

Crystal report

1 个答案:

答案 0 :(得分:2)

在Field Explorer中 - >式 - >新公式。

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