问题
I want to display page wise sum of 2 columns in footer.for that I am using following expression in footer
=Sum(ReportItems!col1.Value) + Sum(ReportItems!col2.Value)
but it gives following error
"The Value expression for the textrun refers to more than one report item. An expression in a page header or footer can refer to only one report item."
anybody knows how can I solve this issue and display page wise sum in footer ?
Thanks
回答1:
Here is simple workaround for your problem:
- Add single textbox to the body of the report and name it i.e. "SUM"
- Add your expression to this textbox
=ReportItems!col1.Value + ReportItems!col2.Value
- For this textbox set visibility as hidden
- In the footer refer to this hidden textbox using
=ReportItems!SUM.Value
回答2:
I usually use Custom code-feature of report for these operations. Just open Report Properties and choose Code-view. Just then write basic VB get/set-methods to save and sum values. Referring to methods in TextBox expression goes just like this: =Code.[YourMethodNameHere]. For example, saving value:
=Code.SaveMyValue(Fields!MyVal.Value)
and getting value:
=Code.GetMyValue()
来源:https://stackoverflow.com/questions/20898506/use-multiple-reportitems-in-one-expression-in-rdlc-report