简体   繁体   English

SSRS-如何缩进具有给定内容的表中的行

[英]SSRS - How to indent rows in a table with a given content

In SSRS I want to indent certain rows when they start with eg 'aa'. 在SSRS中,当某些行以“ aa”开头时,我要缩进它们。 See this example: 请参阅以下示例:

看这个例子

What is the best practice in this case? 在这种情况下,最佳做法是什么? As I don't have a parent-child situation here (to use recursive hierarchy group), do I have an option eg via the properties to set something like an IIf to solve this? 由于我这里没有父子关系(使用递归层次结构组),我是否可以通过属性设置例如IIf之类的选项来解决此问题? If yes, could you please provide some information where to set this? 如果是,请提供一些信息在哪里设置?

Every info is welcome! 欢迎每个信息! I'm new to SSRS. 我是SSRS的新手。

This is simple to do... 这很容易做...

Click on the cell that you want to indent. 单击要缩进的单元格。

In the properties panel, expand the Indent properties and then click the drop-down in the Left Indent property and choose Expression . 在属性面板中,展开“ Indent属性,然后单击“ Left Indent属性中的下拉列表,然后选择“ Expression

Then set the expressions to something like 然后将表达式设置为类似

=SWITCH (
    LEFT(Fields!FieldIwantToCheck.Value, 2) = "aa", "10pt",
    LEFT(Fields!FieldIwantToCheck.Value, 2) = "bb", "30pt",
    True, "0pt"
)

You could do this with an IIF expression but if you need to make it more flexible than 1 or two cases then SWITCH is much easier to read/manage. 您可以使用IIF表达式来执行此操作,但是如果需要使其比1或2种情况更灵活,则SWITCH则更易于读取/管理。

All we are doing here is checking the left 2 characteras of the FieldIwantToCheck field and setting an indent value respectivley. 我们在这里所做的只是检查FieldIwantToCheck字段的左2个字符并设置缩进值。 If none of the criteria match, the final True, Nothing acts like an ELSE and leaves the property as the default Nothing value. 如果没有条件匹配,则最终的True, NothingELSE一样起作用,并将该属性ELSE为默认的Nothing值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM