Properties (MDX)
傳回包含成員屬性值的字串或強型別 (strongly-typed) 值。
語法
Member_Expression.Properties(Property_Name [, TYPED])
引數
Member_Expression
傳回成員的有效多維度運算式 (MDX) 運算式。Property_Name
成員屬性名稱的有效字串運算式。
備註
Properties 函數會傳回指定成員屬性之指定成員的值。成員屬性可以是任何的內建成員屬性,如 NAME、ID、KEY 或 CAPTION,也可以是使用者自訂成員屬性。如需詳細資訊,請參閱<內建成員屬性 (MDX)>和<使用者自訂成員屬性 (MDX)>。
依預設,值會強制轉型成字串。如果指定 TYPED,傳回值會是強型別。
如果為內建的屬性類型,此函數會傳回原始的成員類型。
如果是使用者自訂的屬性類型,傳回值的類型會跟 MemberValue 函數的傳回值類型相同。
[!附註]
Properties ('Key') 會傳回與 Key0 相同的結果,但複合索引鍵例外,因為複合索引鍵的 Properties ('Key') 會傳回 Null。對於複合索引鍵,就依範例所示使用 Keyx 語法。Properties ('Key0')、Properties('Key1')、Properties('Key2') 等共同形成複合索引鍵。
範例
下列範例會傳回內建和使用者自訂成員屬性,並利用 TYPED 引數來傳回 Day Name 成員屬性的強型別值。
WITH MEMBER Measures.MemberName AS
[Date].[Calendar].[July 1, 2003].Properties('Name')
MEMBER Measures.MemberVal AS
[Date].[Calendar].[July 1, 2003].Properties('Member_Value')
MEMBER Measures.MemberKey AS
[Date].[Calendar].[July 1, 2003].Properties('Key')
MEMBER Measures.MemberID AS
[Date].[Calendar].[July 1, 2003].Properties('ID')
MEMBER Measures.MemberCaption AS
[Date].[Calendar].[July 1, 2003].Properties('Caption')
MEMBER Measures.DayName AS
[Date].[Calendar].[July 1, 2003].Properties('Day Name', TYPED)
MEMBER Measures.DayNameTyped AS
[Date].[Calendar].[July 1, 2003].Properties('Day Name')
MEMBER Measures.DayofWeek AS
[Date].[Calendar].[July 1, 2003].Properties('Day of Week')
MEMBER Measures.DayofMonth AS
[Date].[Calendar].[July 1, 2003].Properties('Day of Month')
MEMBER Measures.DayofYear AS
[Date].[Calendar].[July 1, 2003].Properties('Day of Year')
SELECT {Measures.MemberName
, Measures.MemberVal
, Measures.MemberKey
, Measures.MemberID
, Measures.MemberCaption
, Measures.DayName
, Measures.DayNameTyped
, Measures.DayofWeek
, Measures.DayofMonth
, Measures.DayofYear
} ON 0
FROM [Adventure Works]
下列範例示範 KEYx 屬性的用法。
WITH
MEMBER Measures.MemberKey AS
[Customer].[Customer Geography].[State-Province].&[QLD]&[AU].Properties('Key')
MEMBER Measures.MemberKey0 AS
[Customer].[Customer Geography].[State-Province].&[QLD]&[AU].Properties('Key0')
MEMBER Measures.MemberKey1 AS
[Customer].[Customer Geography].[State-Province].&[QLD]&[AU].Properties('Key1')
SELECT {Measures.MemberKey
, Measures.MemberKey0
, Measures.MemberKey1
} ON 0
FROM [Adventure Works]