是否可以在Microsoft Reporting Tablix控件表达式中为表达式添加不可见的注释?如果是的话,你是怎么做到的?
例如,我想在tablix表达式中执行以下操作:
' Only display the spouse last name if it is different.
=IIF(Fields!SLast.Value <> Fields!PLast.Value, Fields!SLast.Value, "")
答案 0 :(得分:1)
您可以在表达式中添加注释,但必须在结尾处进行注释。 Reporting Services表达式是VBA代码,但它们评估为一行VBA代码。在单引号'
被视为注释后,这意味着任何。
因此,您的示例将仅作为文本进行评估,并将该文本放入文本框中。但是,这将有效:
=IIF(Fields!SLast.Value <> Fields!PLast.Value, Fields!SLast.Value, "") ' Only display the spouse last name if it is different.
这也有效:
=IIF(Fields!SLast.Value <> Fields!PLast.Value, Fields!SLast.Value, "")
' Only display the spouse last name if it is different.
但要注意这一点:
=Fields!FirstName.Value + ""
+ Fields!LastName.Value
' Now add the address
+ Fields!Address.Value
在此示例中,地址永远不会显示,因为表达式被放入一行,地址位于注释'
之后,因此被注释掉了。不幸的是,代码突出显示器没有明确这一点,它被标记为有效的可执行代码。