如果没有约会的话,我希望我的代码什么也不显示。
这里是我的代码:
=format(IIF(Fields!Phase.Value = "Pre-Feasibility" OR Fields!Phase.Value = "Selection", Fields!PreFeasibilityCurrentTargetDate.Value, IIF(Fields!Phase.Value = "Feasibility" OR Fields!Phase.Value = "Definition", Fields!FeasibilityCurrentTargetDate.Value, IIF(Fields!Phase.Value = "Implementation", Fields!ImplementationCurrentTargetDate.Value, ""))), "dd-MMM-yy")因为我正在将它格式化为dd-MMM-yy,所以它会在项目没有日期时显示它。如果没有约会,我怎么能把它更改成什么都不显示呢?

发布于 2017-07-25 05:28:49
将表达式的空白值更改为空值。
=Iif(Fields!Phase.Value="Operation","-", format(
IIF(Fields!Phase.Value = "Pre-Feasibility" OR Fields!Phase.Value = "Selection",
Fields!PreFeasibilityCurrentTargetDate.Value,
IIF(Fields!Phase.Value = "Feasibility" OR Fields!Phase.Value = "Definition",
Fields!FeasibilityCurrentTargetDate.Value,
IIF(Fields!Phase.Value = "Implementation",
Fields!ImplementationCurrentTargetDate.Value, Nothing)))
, "dd-MMM-yy") )我还建议您使用字段格式属性,而不是在值表达式中使用format函数。在这种情况下,即使字段值为空,它也能工作。
发布于 2017-07-25 04:09:18
检查这里的MSDN表单,https://msdn.microsoft.com/en-us/library/ms157406.aspx
它明确提到“如果指定无效的格式字符串,格式化的文本将被解释为重写格式设置的文字字符串”。
所以。您需要在格式化后检查字符串,
IIF(output="dd-MMM-yy","",output)https://stackoverflow.com/questions/45293406
复制相似问题