I'm looking to build a web application using an SSAS cube as the data platform.
As such, I would like开发者_StackOverflow to list the dimensions in drop down lists. For example, I have a dimension called Dim Company.
How do I populate the drop down list with these individual companies?
Any examples or pointers greatly appreciated.
ADOMD allows you to query the cube's structure as well as the data. You don't need any MDX; you can get it to list the dimensions on a certain cube, or list the members in a certain level of a certain dimension. Here's a very old ASP example:
Set oCat = Server.CreateObject("ADOMD.Catalog")
Set oCat.ActiveConnection = oCon
Set oDim = oCat.CubeDefs("CubeName").Dimensions("DimName")
Set oMembers = oDim.Hierarchies(0).Levels(2).Members
'then loop oMembers and get their .Caption property
If you do know MDX, you can write a query to list the members you want, without returning any data, and just use part of the results to populate the dropdown. For example:
SELECT {[Location].[All Location].children} ON ROWS,
{} ON COUMNS
FROM [CubeName]
You could even issue this from SQL using OPENROWSET
if you want to.
You can also have a look at CellSetGrid source code.
CellSetGrid is an Open Source ASP .Net (c#) control, which offers pivot table like functionality for SSAS Cubes.
[This used to be available for download in this site: www.SQLServerAnalysisServices.com Now the site does not host this control anymore]
So I have uploaded the source of the control - CellSetGrid here.
http://www.box.net/shared/6gi0n79q6t
精彩评论