0

Below Is My crystal report structure (shown in Image) ,I am using below formula to get Fee Total

If{DataTableDoctorInfo.Fee_Unit}="Percent" Then
formula =  ({DataTableDoctorInfo.Fee}/100)*{DataTable1.Number of Patient}
Else 
formula={DataTableDoctorInfo.Fee}*{DataTable1.Number of Patient}* Sum ({DataTableDrmonthlyData.Payable Amount})
End If

now I also want to add sub total In my formula which i am getting In my subreport from column having sum of that column values ,Now I want to use this sum in above formula something like this

 formula =  ({DataTableDoctorInfo.Fee}/100)*{DataTable1.Number of Patient}* {that sum value which I am getting in sub report}

DrMonthlySubRepoPatient is My sub report shown in image in section 3 ,How I can achieve this ? I tried this code in Main report formula of FeeTotal

WhilePrintingRecords;
Shared CurrencyVar myTotal;
myTotal :=myTotal;

If{DataTableDoctorInfo.Fee_Unit}="Percent" Then
formula =  ({DataTableDoctorInfo.Fee}/100)*{DataTable1.Number of Patient}* myTotal
Else 
formula={DataTableDoctorInfo.Fee}*{DataTable1.Number of Patient}* Sum ({DataTableDrmonthlyData.Payable Amount})
End If

and this formula in subreport fo Payble amount field

WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({DataTableDrmonthlyData.Payable Amount})

but its giving following error,How do I resolve it?

`The remaining Text does not appear to be part of the formula `

enter image description here

4

1 回答 1

1

子报表中的公式缺少分号:

WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({DataTableDrmonthlyData.Payable Amount});

编辑:

看到截图后,我觉得你的报表结构不太好。请参阅这篇文章的答案,了解如何构建报告。另一件非常重要的事情是公式的位置,以及使用链接子报表的可能性。请阅读这篇文章以获取有关如何在报表和子报表之间传递值的更多信息。我会将所有内容都保留在页眉中的黑线之上。创建一个组 1 并将所有内容放在黑线下方。基于患者人数的组。现在您的子报表需要“高于”您的总费用公式,以便总费用可以访问该值。子报表中公式的语法应该是

WhilePrintingRecords;
Shared CurrencyVar myTotal := Sum ({DataTableDrmonthlyData.Payable Amount});

然后在你的主公式中,你可以像这样声明变量

WhilePrintingRecords;
Shared CurrencyVar myTotal := myTotal;

并在公式的其余部分使用它。

我认为你的问题是你的报告的结构。

于 2013-10-25T18:13:03.140 回答