Is there a quick way to set a visiblity expression for many rows in a SQL Server Report Services RDLC report?

给你一囗甜甜゛ 提交于 2019-12-13 21:30:45

问题


I have a report with many tables (tablixes?), in which I need to hide all rows that don't have a value in the 2nd column:

I can do this by right clicking on each row

and setting an expression for the visibility of the row that depends on a value appearing in the field of the 2nd column, e.g.

=IIF((Fields!MyField4.Value = ""), True, False)

But the problem is that my report has over 1000 of these rows! It will take a very long time given that each field has a specific name! I can modify the Xml, but this will also take a while. I am currently writing some code, which uses XDocument, to achieve this.

Are there any faster ways that anyone can think of? Maybe something from the designer, or some VB code? Everywhere on the internet seems to suggest right clicking one row at a time.


回答1:


In the Designer, select all of the rows (using your Shift or Ctrl key), and use the Properties pane in VS/BIDS to change them all at once. There is a Hidden property there, and you can choose Expression from the dropdown in it. From there, you can apply the IIF to all rows.

Of course, I am assuming all of the visibility is based on the exact same expression for each row. If not, then the answer is no. Unless, you want to start doing some copy/paste stuff in the RDL XML, which I do not recommend.



来源:https://stackoverflow.com/questions/36769524/is-there-a-quick-way-to-set-a-visiblity-expression-for-many-rows-in-a-sql-server

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