2013-10-25 49 views
0

下面是我的水晶報表結構(在圖像顯示),我用下面的公式來獲得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 

現在我也想添加子總在我的公式,我是從具有列值的sum列讓我在subreport,現在我想用這筆錢在上面的公式是這樣的

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

DrMonthlySubRepoPatient是圖像顯示我的子報告,我怎麼能做到這一點? 我試着在Main report公式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 

此代碼,這個公式在報表FO Payble量場

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

但其下面的錯誤付出,我該如何解決呢?

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

enter image description here

+0

順便說一下,我沒有看到任何圖像。 :) –

+0

@ campagnolo_1插入圖片 – Durga

回答

1

在子報表的formuala缺少一個分號:

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

編輯:

看到的截圖之後,我覺得你的報告結構不是很好。有關如何構建報告,請參閱此post的答案。另一件非常重要的事情是放置公式,以及使用鏈接子報表的可能性。有關如何在報告和子報告之間傳遞值的更多信息,請閱讀post。 我會在頁眉中的黑線之上留下一切。創建一個組1,並將所有內容放在黑線之下。根據患者人數確定小組。現在您的子報告需要「高於」費用總計公式,以便費用總計可以訪問該值。 在報表公式的語法應該是

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

然後你的主配方中,你可以聲明變量這樣

WhilePrintingRecords; 
Shared CurrencyVar myTotal := myTotal; 

,並在公式的其餘使用它。

我認爲你的問題是你的報告的結構。

+0

它顯示我同樣的錯誤 – Durga

+0

請參閱修訂答案。 –