简体   繁体   English

SSRS参数传递问题

[英]SSRS Parameter Passing Issue

We're using SSRS within an application where users login and are authenticated based on their Store. 我们在用户登录并根据其商店进行身份验证的应用程序中使用SSRS。 When they generate reports, we pass their store name to SSRS to generate report for their store. 当他们生成报告时,我们将其商店名称传递给SSRS来为其商店生成报告。 Everything works fine on the first report generation. 第一代报告一切正常。 But when the user picks a different date range, they get report for all of the stores in the system. 但是,当用户选择其他日期范围时,他们将获得系统中所有商店的报告。 We use MDX to feed the default and available parameter for store name in the .rdl as follows: 我们使用MDX为.rdl中的商店名称提供默认和可用参数,如下所示:

SELECT NON EMPTY { [Measures].[MTDActiveMembers], [Measures].[YTDActiveMembers],
 [Measures].[MTDMembers], [Measures].[YTDMembers], [Measures].[Members], 
[Measures].[Members-Active] } 
ON COLUMNS, NON EMPTY { ([Store].[Store].[Store].ALLMEMBERS ) } DIMENSION 
PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( 
STRTOSET(@StoreStore, CONSTRAINED) ) ON COLUMNS 
FROM ( SELECT ( STRTOMEMBER(@FromCalendarDateHierarchy, CONSTRAINED) : 
STRTOMEMBER(@ToCalendarDateHierarchy, CONSTRAINED) ) ON COLUMNS FROM [Members])) 
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, 
FONT_NAME, FONT_SIZE, FONT_FLAGS

Stepping through the app revealed that when the user picks a different date range, all the parameters are intact, correct store name is preserved, but when the user hits "View Report" parameter for store name changes to ALL. 逐步浏览该应用程序后发现,当用户选择其他日期范围时,所有参数均保持不变,将保留正确的商店名称,但是当用户单击“查看报告”参数时,商店名称将更改为ALL。 :w00t: What could be wrong? :w00t:有什么问题吗? As far as app is concerned "View Report" is a black box, so don't know what to change with the rdl :( Thanks in advance for your input. 就应用程序而言,“查看报告”是一个黑匣子,所以不知道使用rdl会发生什么变化:(预先感谢您的输入。

--Edited Sorry, the query I provided above is the actual report query. -抱歉,我上面提供的查询是实际的报表查询。 Parameter query is this: WITH MEMBER [Measures].[ParameterCaption] AS [Store].[Store].CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures].[ParameterValue] AS [Store].[Store].CURRENTMEMBER.UNIQUENAME MEMBER [Measures].[ParameterLevel] AS [Store].[Store].CURRENTMEMBER.LEVEL.ORDINAL SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Store].[Store].ALLMEMBERS ON ROWS FROM ( SELECT ( STRTOMEMBER(@FromCalendarDateHierarchy, CONSTRAINED) : STRTOMEMBER(@ToCalendarDateHierarchy, CONSTRAINED) ) ON COLUMNS FROM [Members]) 参数查询是这样的:WITH MEMBER [Measures]。[ParameterCaption] AS [Store]。[Store] .CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures]。[ParameterValue] AS [Store]。[Store] .CURRENTMEMBER.UNIQUENAME MEMBER [Measures] 。[ParameterLevel] AS [Store]。[Store] .CURRENTMEMBER.LEVEL.ORDINAL SELECT {[Measures]。[ParameterCaption],[Measures .. [ParameterValue],[Measures]。[ParameterLevel]}在列上,[Store] 。[Store]。行上的ALLMEMBERS来自([[成员]的列上SELECT(STRTOMEMBER(@FromCalendarDateHierarchy,CONSTRAINED):STRTOMEMBER(@ToCalendarDateHierarchy,CONSTRAINED))

Hi Instead of returning really all members you need to change following line : 嗨,您无需更改所有成员,而是需要更改以下行:

 NON EMPTY { ([Store].[Store].[Store].ALLMEMBERS ) }

To: 至:

 NON EMPTY { [Store].[Store].[Store] }

It will return to you only those which have values. 它只会回到你那些具有价值。

The problem should be that when the Date is modified all the parameters below this are updated, you must check if the Store parameter is below the Date parameter : 这个问题应该是,当日期被修改低于这个被更新的所有参数,必须检查Store parameter以下 Date parameter 在此处输入图片说明

Move the Store parameter above the Date with the arrow Up 移动Store上述参数Date与箭头向上 在此处输入图片说明

I hope this helps 我希望这有帮助

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

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