我正在尝试编写一个MDX语句,我在结果集中查询维度成员唯一名称和标题。
例如:
Member 1 Unique Name | Member 1 Caption
Member 2 Unique Name | Member 2 Caption
Member 3 Unique Name | Member 3 Caption
Member 4 Unique Name | Member 4 Caption
Member 5 Unique Name | Member 5 Caption
使用ADOMD,我正在尝试检索任何给定维度属性的成员列表(不管现在的层次结构如何)并将它们保存在对象中。我不确定如何编写MDX语句
任何帮助?
答案 0 :(得分:1)
我不确定我是否真的理解你的目的,但这里有一个MDX语句,它为特定维度层次结构的成员获取唯一的名称和标题。
WITH MEMBER Measures.DimensionUniqueName as
[Dimension].[Hierarchy].Currentmember.Unique_Name
MEMBER Measures.DimensionCaption as
[Dimension].[Hierarchy].Currentmember.Member_caption
SELECT Measures.DimensionUniqueName, Measures.DimensionCaption on 0,
[Dimension].[Hierarchy].children on 1
from [Cube]
例如,如果我的维度[Product]具有层次结构[Category]和4个成员:
我会使用以下查询:
WITH MEMBER Measures.DimensionUniqueName as
[Product].[Category].Currentmember.Unique_Name
MEMBER Measures.DimensionCaption as
[Product].[Category].Currentmember.Member_caption
SELECT {Measures.DimensionUniqueName, Measures.DimensionCaption} on 0,
[Product].[Category].children on 1
from [Cube]
得到这个结果
您可以忽略第一列,或者如果您不关心订单,则不需要会员标题,因为这是您默认致电会员时显示的内容(换句话说,您不会因为它是多余的,所以需要第三列。
我猜你可以动态填充MDX语句,为每个维度层次结构执行其中一个操作。