Databases Reference
In-Depth Information
This request returns only one member. The name of the manager of store number 19
begins with the letter R (Ruth):
[Store].[Stores].[Store].&[19];
In the example, we used the BeginsWith attribute to filter the response. One call of the
GetMembers method can contain multiple filters; each filter can contain only one attribute.
You can choose from the following filter attributes:
.
Equals to limit the returned members to those of a specified value
.
BeginsWith to limit the returned members to those that start with a specified substring
.
EndsWith to limit the returned members to those that end with a specified substring
.
Contains to limit the returned members to those that contain a specified substring
In Listing 33.8, you had to trust our word that the name of the manager of store number
19 in the city of Vancouver is Ruth. Using the overload method GetMembers(long start,
long count, string [] properties, params MemberFilter [] filters) , you can prove
to yourself (trusting only to the accuracy of the data) that Ruth is the manager. The over-
load method GetMembers allows the application to request the names that
MemberProperties collection will be populated with. When you specify properties , you
can specify both custom member properties and built-in (intrinsic) member properties. In
Listing 33.9, we take a look at how to request all available custom member properties.
LISTING 33.9 GetMembers(long start, long count, string [] properties,
params MemberFilter [] filters)
//Open a connection to a source of data.
AdomdConnection con = new AdomdConnection();
con.ConnectionString = “Datasource=localhost; Initial Catalog=Foodmart 2008;”;
con.Open();
//Get the level
Level lvl = con.Cubes[“Warehouse and Sales”].Dimensions[“Store”].
Hierarchies[“Stores”].Levels[“Store”];
long start = 0;
long count = lvl.MemberCount;
MemberFilter mf = new MemberFilter(“Store Manager”, MemberFilterType.BeginsWith,
“R”);
//Create an array of member properties
string[] properties = new string [lvl.LevelProperties.Count];
int i = 0;
Search WWH ::




Custom Search