Use multiple ReportItems in one expression in RDLC Report

柔情痞子 提交于 2020-01-14 13:53:19

问题


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:

  1. Add single textbox to the body of the report and name it i.e. "SUM"
  2. Add your expression to this textbox =ReportItems!col1.Value + ReportItems!col2.Value
  3. For this textbox set visibility as hidden
  4. 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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!