使用AMO我可以愉快地确认二维属性的存在。我想建立一种关系。以下(结果)返回结果代码0,但这意味着在处理多维数据集之后没有任何关系。建议?
// confirm db exists
db = objServer.Databases.FindByName(strCubeDBName);
// find the dimension
string dimName = "Product";
Dimension dim = db.Dimensions.FindByName(dimName);
attrSource = dim.Attributes.FindByName("Spanish Product Subcategory Name");
if (attrSource != null)
Console.WriteLine(attrSource + " - source attribute exists");
else
throw new Exception(attrSource + " - source attribute does not exist");
attrRelated = dim.Attributes.FindByName("French Product Subcategory Name");
if (attrRelated != null)
Console.WriteLine(attrRelated + " - Related attribute exists");
else
throw new Exception(attrRelated + " - Related attribute does not exist");
int result;
result = attrSource.AttributeRelationships.Add(new AttributeRelationship(attrRelated));
Console.WriteLine(result);
dim.Process(ProcessType.ProcessUpdate);
答案 0 :(得分:0)
添加新属性关系后,您需要在维度上调用Update。在上面的代码中,在调用Process
之前,添加以下行:
dim.Update(UpdateOptions.ExpandFull | UpdateOptions.AlterDependents)