0

我已经在哪个报告参数中指定了值

Label                                    Value 
Occupancy                                Occupancy 
Pitch Nights Sold                        PitchNightsSold 
Capacity                                 Capacity 
Pitch Nights Sold And Capacity           PitchNightsSoldAndCapacity 
Pitch Nights Sold And Occupancy          PitchNightsSoldAndOccupancy 
Pitch Nights Sold Capacity And Occupancy PitchNightsSoldCapacityAndOccupancy 

主要数据集:

SELECT 

OccupancyDetail.CalendarYear, 
OccupancyDetail.CalendarMonth, 
SUM(OccupancyDetail.No_of_Nights) AS No_of_Nights, 
SUM(OccupancyDetail.Capacity) AS Capacity

FROM            
OccupancyDetail INNER JOIN
    Site ON OccupancyDetail.Site_Skey = Site.Site_Skey

WHERE  (OccupancyDetail.ReferenceDate = convert(Date,getdate()))
AND CASE WHEN @Time = 'YEAR' THEN CAST(CalendarYear as varchar(4)) else CalendarMonth + ' ' + CAST(CalendarYear as varchar(4)) end in (@Dates)

AND ((@ReportingLevel = 'BDM' AND Site.BDM in(@BDM_Region_Site))
    OR (@ReportingLevel = 'Region' AND Site.Region in (@BDM_Region_Site))
    OR (@ReportingLevel = 'SiteName' AND Site.SiteName in (@BDM_Region_Site)))

GROUP BY OccupancyDetail.ReferenceDate,OccupancyDetail.CalendarYear, OccupancyDetail.CalendarMonth

时间数据集:

select 
DateChoice 

FROM
(
select distinct 
CalendarYear, 
1 as MonthNumber,
CAST(CalendarYear as varchar(4)) as DateChoice 
from Time
where @Time = 'YEAR'


union all

select Distinct 
CalendarYear, 
MonthNumber,
CalendarMonth + ' ' + CAST(CalendarYear as varchar(4)) as DateChoice 
from Time 
where @Time = 'MONTH'
) as QRYDATA

ORDER BY CalendarYear,MonthNumber

站点数据集:

SELECT DISTINCT BDM AS SiteInfo FROM Site
WHERE @ReportingLevel = 'BDM'


UNION ALL

SELECT DISTINCT Region  FROM Site
WHERE @ReportingLevel = 'Region'


UNION ALL

SELECT DISTINCT SiteName  FROM Site
WHERE @ReportingLevel = 'SiteName'

在 Report Builder 3.0 上,我创建了 6 个隐藏的报告,除非在参数中选择它:

报告代码可见性字符串:

=iif(Parameters!WhichReport.Value(0) = "Occupancy", False, True)

但我想要做的是使参数成为一个多选参数,这样有人可以选择两个图表而不是 1 或选择所有 6 个等,但无论选择什么,所有其他报告都需要保持隐藏。这可以做到吗?如果可以,怎么做?

谢谢

韦恩

4

1 回答 1

0

您可以修改Hidden表达式以实现此目的:

使用 将所有选定的报告转换为字符串Join,然后检查相关报告名称是否在字符串中,例如:

=IIf(
  InStr(Join(Parameters!WhichReport.Value, ","), "Occupancy Report") > 0
  , False
  , True
)

或者,对于不同的项目:

=IIf(
  InStr(Join(Parameters!WhichReport.Value, ","), "Capacity Report") > 0
  , False
  , True
)

评论后编辑:

我猜你会得到不匹配的值,PitchNightsSold并且PitchNightsSoldAndCapacity会混淆所写的表达式。

我将使用类似于以下的数据集来控制项目的可见性:

Label                                      Value
-----                                      -----
Occupancy                                  Chart1
Pitch Nights Sold                          Chart2
Capacity                                   Chart3
Pitch Nights Sold And Capacity             Chart4
Pitch Nights Sold And Occupancy            Chart5
Pitch Nights Sold Capacity And Occupancy   Chart6

然后像这样的表达式:

=IIf(
  InStr(Join(Parameters!WhichReport.Value, ","), "Chart1") > 0
  , False
  , True
)

只适用于一项。

由于这些是您自己的内部常量值,您可以随意调用它们;只是让它们清晰明确。标签将保持不变,因此用户在运行报告时不会受到影响。

评论后编辑:

在评论中@glh 为类似Value值提供了一个很好的解决方案:

...如果你用逗号换行并搜索它们,这将删除部分发现。

所以像:

=IIf(
  InStr("," + Join(Parameters!WhichReport.Value, ",") + ",", ",PitchNightsSold,") > 0
  , False
  , True
)

也会很好地工作;感谢他的建议。

于 2013-03-12T13:09:56.767 回答