0

使用 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);
4

1 回答 1

0

添加新的属性关系后,需要对维度调用Update。在上面的代码中,就在调用之前Process,添加以下行:

dim.Update(UpdateOptions.ExpandFull | UpdateOptions.AlterDependents)
于 2012-12-21T16:41:24.473 回答