Friday, February 24, 2012

AMO: how to get a SourceColumnName from a measure object?

Hi, friends, please look this:

In AMO, I can get a measure object:

Dim meas As Microsoft.AnalysisServices.Measure

meas = tDatabase.Cubes(0).MeasureGroups(0).Measures(0)

Dim dt as DataItem= meas.source

Now I want to find the meas' SourceColumnName, that is, the ColumnName of the measure mapped to.

But how? I tried the meas.source's property, but did not find anyone like a Name.

Please help me.

Thanks!

Hi there,

Try

tDatabase.Cubes(0).MeasureGroups(0).Measures(0).Source.Source.ToString()

C

|||

Thanks!|||

The source of a Measure can be either a:

1. ColumnBinding (the common case): this points (with the TableID and ColumnID properties) to a System.Data.DataColumn in the DataSourceView of the Cube (specified in the Cube.Source property). This DataColumn can be either a regular column or a calculated column, there are these special extended properties (in the DataColumn.ExtendedProperties collection) to consider: DbColumnName (provides the real column name in the relational table, this is usually the same with the DataColumn.ColumnName) and DbExpression (provides the SQL expression for a calculated column)

2. RowBinding: used for row count measures, points (with the TableID property) to the System.Data.DataTable in the DataSourceView

3. MeasureBinding: used for linked measures (in a linked measure group), points (with the MeasureID property) to the measure to link

Adrian Dumitrascu

|||

I am trying to , via AMO, get the type of Binding for a measure (column, row, measure) and then return, when the type is columnbinding, the columnid and tableid from the DSV. Could you provide an example?

No comments:

Post a Comment