我一直在尝试通过以下链接访问SSAS度量值组的属性。我不擅长编码。
https://msdn.microsoft.com/en-us/library/ms154309(v=sql.120).aspx
我的预期输出是
MeasureGroupName (String) , Source (string) 我可以把一些代码放在下面..请帮我完成这项工作。
Cube cube = database.Cubes.FindByName(cubeName);
MeasureGroup sampleMeasureGroup = cube.MeasureGroups[0];
var measures = sampleMeasureGroup.Source;发布于 2015-07-25 02:48:31
所以这段代码将会得到它:
Cube cube = database.Cubes.FindByName(cubeName);
string sDSV = cube.DataSourceView.Name;要获取表名,请执行以下操作:
Cube cube = database.Cubes.FindByName(cubeName);
MeasureGroup sampleMeasureGroup = cube.MeasureGroups[0];
DataItem di = sampleMeasureGroup.Measures[0].Source;
if (di == null) return null;
ColumnBinding cb = di.Source as ColumnBinding;
RowBinding rb = di.Source as RowBinding;
string sTableID = (cb != null ? cb.TableID : (rb != null ? rb.TableID : null));
if (sTableID == null) return null;
if (cube.DataSourceView.Schema.Tables[sTableID] != null)
{
if (cube.DataSourceView.Schema.Tables[sTableID].ExtendedProperties.ContainsKey("FriendlyName"))
{
return cube.DataSourceView.Schema.Tables[sTableID].ExtendedProperties["FriendlyName"].ToString();
}
else
{
return cube.DataSourceView.Schema.Tables[sTableID].TableName;
}
}
else
{
return sTableID;
}如果您需要列出度量值组的DSV表名称,则可以尝试此BIDS Helper report。
https://stackoverflow.com/questions/31561170
复制相似问题