SSRS - 带参数的奇怪错误

时间:2016-02-10 14:49:33

标签: sql-server reporting-services parameters dataset ssrs-2008

我在SSRS中创建报告时遇到了问题。

我有一个数据集,其中包含我在其他2个数据集中需要的所有ID。 ID不是来自同一维度,而是一个多值参数。包含所有ID的数据集获得了此查询:

SELECT NON EMPTY { [Measures].[Barley Volume] } ON COLUMNS, NON EMPTY { ([70 Steeping General].[Batch Number].[Batch Number].ALLMEMBERS * [70 Steeping General].[Plant Name].[Plant Name].ALLMEMBERS * [70 Steeping General].[Production Unit].[Production Unit].ALLMEMBERS * [65 Batch Process Data].[Steeping Start Date].[Steeping Start Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( STRTOMEMBER(@FromSteepingGeneralStartDay, CONSTRAINED) : STRTOMEMBER(@ToSteepingGeneralStartDay, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@SteepingGeneralProductionUnit, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@SteepingGeneralPlantName, CONSTRAINED) ) ON COLUMNS FROM [Supervision]))) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

批号是我正在谈论的ID,正如您所看到的,在此DataSet中,它们来自维[70 Steeping General].[Batch Number].[Batch Number]。此数据集不是自动生成的,因此它返回的值不包括维度(它们返回例如“1234567890”而不是“[70 Steeping General]。[批号]。& [1234567890]”)

对于我需要的第一个DataSet,这是查询:

SELECT NON EMPTY { [Measures].[Air Temperature Out - Fact Germination Continue] } ON COLUMNS, NON EMPTY { ([81 Germination Continue].[Batch Number].[Batch Number].ALLMEMBERS * [80 Germination General].[Plant Name].[Plant Name].ALLMEMBERS * [80 Germination General].[Production Unit].[Production Unit].ALLMEMBERS * [81 Germination Continue].[Characteristic Date].[Characteristic Date].ALLMEMBERS * [80 Germination General].[Start Date  Unloading].[Start Date  Unloading].ALLMEMBERS * [80 Germination General].[Start Date].[Start Date].ALLMEMBERS * [80 Germination General].[End Date].[End Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( STRTOSET(@GerminationGeneralProductionUnit, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@GerminationGeneralPlantName, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@GerminationContinueBatchNumber, CONSTRAINED) ) ON COLUMNS FROM [Supervision]))) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

如您所见,在此数据集中,批次编号的维度为[81 Germination Continue].[Batch Number].[Batch Number]

在DataSet属性中,@GerminationContinueBatchNumber的参数值为:

="{[81 Germination Continue].[Batch Number].&[" + Join(Parameters!BatchNumbers.Value, "],[81 Germination Continue].[Batch Number].&[") + "]}"

此参数正常工作。

关于其他数据集,查询为:

SELECT NON EMPTY { [Measures].[Germ1 Delta Temp In Out Inf], [Measures].[Germ2 Delta Temp In Out Sup], [Measures].[Germ2 Delta Temp In Out Inf], [Measures].[Germ1 Delta Temp In Out Sup], [Measures].[Germ Nb Sprays] } ON COLUMNS, NON EMPTY { ([65 Batch Process Data].[Batch Number].[Batch Number].ALLMEMBERS * [01 Plants].[Plant Name].[Plant Name].ALLMEMBERS * [04 Production Units].[Production Unit].[Production Unit].ALLMEMBERS * [65 Batch Process Data].[Steeping Start Date].[Steeping Start Date].ALLMEMBERS ) } DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT ( STRTOSET(@BatchProcessDataBatchNumber, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@ProductionUnitsProductionUnit, CONSTRAINED) ) ON COLUMNS FROM ( SELECT ( STRTOSET(@PlantsPlantName, CONSTRAINED) ) ON COLUMNS FROM [Supervision]))) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS

批号的尺寸为[65 Batch Process Data].[Batch Number].[Batch Number]

在DataSet属性中,对于参数@BatchProcessDataBatchNumber,值为:

="{[65 Batch Process Data].[Batch Number].&[" + Join(Parameters!BatchNumbers.Value, "],[65 Batch Process Data].[Batch Number].&[") + "]}"

正如您所看到的,它与第一个参数值非常相似,但是这个值不起作用。

如果我删除此数据集,则报表正在运行,因此它适用于其他数据集,但如果我不删除它,则会收到错误:

  

查询(1,594)违反了STRTOSET功能中CONSTRAINED标志所施加的限制。

     

数据集'DataBatchProcessData'的查询执行失败。 (rsErrorExecutingCommand)

我不明白为什么它适用于第一个数据集而不是第二个数据集,错误确实来自此参数,但为什么?

感谢您的帮助:)

0 个答案:

没有答案