如何在SSRS中设置可见性表达式?

时间:2012-02-14 15:29:38

标签: tsql ssrs-2008 visibility ssrs-expression

我正在使用带有Tablix的SSRS 2008。当字段值= 1时,我想让我的一行可见,当此值= 0时,我想使其不可见。如何配置?现在我右键单击某行并输入表达式的字段值。然后我说“= 1”可见。我也尝试过:=“1”(文字),真实,“真实”。

但是所有这些都导致行总是出现,无论它是1还是0.这是一个整数字段值。如何重写表达式以使该行可见或不可见,具体取决于值?

我认为现在的问题是T-SQL而不是SSMS。目前,它将在不同的行上返回这些记录。相反,我认为我只需要在一行中使用所有这些值,以便所有这些值一次可以出现在表中。我怎么能重写这个片段只在一行上返回相同的信息?

CASE WHEN [test_details].[test_setup_details_caption] LIKE '%?%' 
      THEN LEFT([test_details].[test_setup_details_caption],CHARINDEX('?',[test_details].[test_setup_details_caption]))
      ELSE [test_details].[test_setup_details_caption] END [test_setup_details_caption],
      [test_details_answers_expanded_view].[test_setup_answers_value],
      CASE WHEN [test_details].[test_setup_details_caption] in ( 'Self-Harm', 'Suicidal Ideations / Attempts')
            AND [test_details_answers_expanded_view].[test_setup_answers_value] >0 THEN 1 ELSE 0 END AS [Self_Harm_Flag],
      CASE WHEN [test_details].[test_setup_details_caption] in ( 'Substance Abuse / Drug Use')
            AND [test_details_answers_expanded_view].[test_setup_answers_value] >0 THEN 1 ELSE 0 END AS [Drug_Use_Flag],
      CASE WHEN [test_details].[test_setup_details_caption] in ( 'Homicidal Ideations / Attempts')
            AND [test_details_answers_expanded_view].[test_setup_answers_value] >0 THEN 1 ELSE 0 END AS [Homicidal_Falg],
      CASE WHEN [test_details].[test_setup_details_caption] in ( 'Runaway Behavior')
            AND [test_details_answers_expanded_view].[test_setup_answers_value] >0 THEN 1 ELSE 0 END AS [Runaway_Flag],
      CASE WHEN [test_details].[test_setup_details_caption] in ( 'Problem Sexual Behavior', 'Inappropriate Sexual Behavior')
            AND [test_details_answers_expanded_view].[test_setup_answers_value] >0 THEN 1 ELSE 0 END AS [Sexual_Bx_Flag],
      CASE WHEN [test_details].[test_setup_details_caption] in ( 'Gang Involvement')
            AND [test_details_answers_expanded_view].[test_setup_answers_value] >0 THEN 1 ELSE 0 END AS [Gang_Flag]

1 个答案:

答案 0 :(得分:5)

您正在设置表达式:隐藏,正确吗?尝试:

=IIf(Parameters!value.Value = 1, False, True) ' Note: Setting Hidden to False will make the row visible

您可能需要一些其他逻辑,因为您引用“我的一行”而不是所有行

=IIf((Parameters!value.Value = 1) And (RowNumber(Nothing) = 5), False, True) ' Only applies to row # 5