MDX 查询 STRTOSET CONSTRAINED 标志
MDX Query STRTOSET CONSTRAINED flag
我不熟悉 MDX 语言,我遇到了数据集 (DataBatchProcessData) 的问题,这是 MDX 查询:
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
("{[65 Batch Process Data].[Batch Number].&[1320165073],[65 Batch Process Data].[Batch Number].&[1320165074],[65 Batch Process Data].[Batch Number].&[1320165075]}"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("[04 Production Unit].[Production Unit].&[1]"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("[01 Plants].[Plant Name].&[Rostock]"
,CONSTRAINED
) ON COLUMNS
FROM [Supervision]
)
)
)
CELL PROPERTIES
VALUE
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAGS;
此 MDX 查询由 SSRS 自动生成,但无法正常工作,我在 运行 生成报告时遇到此错误:
Query (8, 9) The restrictions imposed by the CONSTRAINED flag in the STRTOSET function were violated.
我得到了另一个与此数据集非常相似的数据集 (DataGermination),它采用相同的参数(但不在同一维度):
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
("[80 Germination General].[Production Unit].&[1]"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("[80 Germination General].[Plant Name].&[Rostock]"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("{[81 Germination Continue].[Batch Number].&[1320165073],[81 Germination Continue].[Batch Number].&[1320165074],[81 Germination Continue].[Batch Number].&[1320165075]}"
,CONSTRAINED
) ON COLUMNS
FROM [Supervision]
)
)
)
CELL PROPERTIES
VALUE
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAGS;
当我 运行 在 SSMS 中查询这些时,第二个正在工作(DataGermination),但我不知道为什么,数据集 DataBatchProcessData 没有。
我怀疑您指定的成员之一在多维数据集中不存在。
易于测试。
如果您将以下内容添加到一个非常非常简单的mdx
脚本中,是否可以运行?
{[65 Batch Process Data].[Batch Number].&[1320165073]
,[65 Batch Process Data].[Batch Number].&[1320165074]
,[65 Batch Process Data].[Batch Number].&[1320165075]}
仅以下内容可以说明它是否识别这些成员:
SELECT
{} ON ROWS
,{
[81 Germination Continue].[Batch Number].&[1320165073]
,[81 Germination Continue].[Batch Number].&[1320165074]
,[81 Germination Continue].[Batch Number].&[1320165075]
} ON COLUMNS
FROM [Supervision];
来自 BOL:
When the CONSTRAINED flag is used, the set specification must contain
qualified or unqualified member names or a set of tuples containing
qualified or unqualified member names enclosed by braces {}. This flag
is used to reduce the risk of injection attacks via the specified
string. If a string is provided that is not directly resolvable to
qualified or unqualified member names, the following error appears:
"The restrictions imposed by the CONSTRAINED flag in the STRTOSET
function were violated.
您似乎没有为属性使用完全限定的成员名称。
需要
Dimension Name.Hierarchy Name.Level Name.Member Name
或
Dimension Name.Hierarchy Name.Level Name.&[Member Value]
你是对的 SouravA,我的问题是批号。
它期待 [65 Batch Process Data].[Batch Number].&[Batch Number]&[Plant Code]&[Production Unit]
我给他的时候[65 Batch Process Data].[Batch Number].&[Batch Number]
感谢您的帮助!
我不熟悉 MDX 语言,我遇到了数据集 (DataBatchProcessData) 的问题,这是 MDX 查询:
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
("{[65 Batch Process Data].[Batch Number].&[1320165073],[65 Batch Process Data].[Batch Number].&[1320165074],[65 Batch Process Data].[Batch Number].&[1320165075]}"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("[04 Production Unit].[Production Unit].&[1]"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("[01 Plants].[Plant Name].&[Rostock]"
,CONSTRAINED
) ON COLUMNS
FROM [Supervision]
)
)
)
CELL PROPERTIES
VALUE
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAGS;
此 MDX 查询由 SSRS 自动生成,但无法正常工作,我在 运行 生成报告时遇到此错误:
Query (8, 9) The restrictions imposed by the CONSTRAINED flag in the STRTOSET function were violated.
我得到了另一个与此数据集非常相似的数据集 (DataGermination),它采用相同的参数(但不在同一维度):
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
("[80 Germination General].[Production Unit].&[1]"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("[80 Germination General].[Plant Name].&[Rostock]"
,CONSTRAINED
) ON COLUMNS
FROM
(
SELECT
StrToSet
("{[81 Germination Continue].[Batch Number].&[1320165073],[81 Germination Continue].[Batch Number].&[1320165074],[81 Germination Continue].[Batch Number].&[1320165075]}"
,CONSTRAINED
) ON COLUMNS
FROM [Supervision]
)
)
)
CELL PROPERTIES
VALUE
,BACK_COLOR
,FORE_COLOR
,FORMATTED_VALUE
,FORMAT_STRING
,FONT_NAME
,FONT_SIZE
,FONT_FLAGS;
当我 运行 在 SSMS 中查询这些时,第二个正在工作(DataGermination),但我不知道为什么,数据集 DataBatchProcessData 没有。
我怀疑您指定的成员之一在多维数据集中不存在。
易于测试。
如果您将以下内容添加到一个非常非常简单的mdx
脚本中,是否可以运行?
{[65 Batch Process Data].[Batch Number].&[1320165073]
,[65 Batch Process Data].[Batch Number].&[1320165074]
,[65 Batch Process Data].[Batch Number].&[1320165075]}
仅以下内容可以说明它是否识别这些成员:
SELECT
{} ON ROWS
,{
[81 Germination Continue].[Batch Number].&[1320165073]
,[81 Germination Continue].[Batch Number].&[1320165074]
,[81 Germination Continue].[Batch Number].&[1320165075]
} ON COLUMNS
FROM [Supervision];
来自 BOL:
When the CONSTRAINED flag is used, the set specification must contain qualified or unqualified member names or a set of tuples containing qualified or unqualified member names enclosed by braces {}. This flag is used to reduce the risk of injection attacks via the specified string. If a string is provided that is not directly resolvable to qualified or unqualified member names, the following error appears: "The restrictions imposed by the CONSTRAINED flag in the STRTOSET function were violated.
您似乎没有为属性使用完全限定的成员名称。
需要
Dimension Name.Hierarchy Name.Level Name.Member Name
或
Dimension Name.Hierarchy Name.Level Name.&[Member Value]
你是对的 SouravA,我的问题是批号。
它期待 [65 Batch Process Data].[Batch Number].&[Batch Number]&[Plant Code]&[Production Unit]
我给他的时候[65 Batch Process Data].[Batch Number].&[Batch Number]
感谢您的帮助!