public static object LookupAdomdSchemaObject(CubeDef cube, SourceSchemaMap.MapRow row) { string typeStr = row.SourceUniqueName.Substring(0, row.SourceUniqueName.IndexOf(':', 0)); string uniqueName = row.SourceUniqueName.Substring(row.SourceUniqueName.IndexOf(':', 0) + 1); return(LookupAdomdSchemaObject(cube, typeStr, uniqueName)); }
public string ConvertSchemaObjectUN(SchemaObjectType type, string uniqueName) { SourceSchemaMap.MapRow row = null; string toReplace = uniqueName; // if its' member, extract parent object if (type == SchemaObjectType.ObjectTypeMember) { // lookup by key int delimiterIndex = uniqueName.IndexOf("].&["); if (delimiterIndex >= 0) { toReplace = uniqueName.Substring(0, delimiterIndex + 1); // try to lookup as level row = this.GetMapRow(SchemaObjectType.ObjectTypeLevel, toReplace); // if not found, try as hierarchy if (row == null) { row = this.GetMapRow(SchemaObjectType.ObjectTypeHierarchy, toReplace); } } else { // if measure if (uniqueName.StartsWith("[Measures]")) { row = this.GetMapRow(SchemaObjectType.ObjectTypeMeasure, toReplace); } else // lookup as member (all member) { row = this.GetMapRow(SchemaObjectType.ObjectTypeMember, toReplace); } //if (row == null) // throw new Exception("Unable to find parent object for member " + uniqueName); } } else // straight full-name lookup { row = this.GetMapRow(type, toReplace); } // return if (row == null || row.IsDestUniqueNameNull() || row.DestUniqueName == "") { return(null); } else { string replaceWith = row.DestUniqueName.Substring(row.DestUniqueName.IndexOf(':', 0) + 1); return(uniqueName.Replace(toReplace, replaceWith)); } }
void Map_RowChanged(object sender, DataRowChangeEventArgs e) { SourceSchemaMap.MapRow row = (SourceSchemaMap.MapRow)e.Row; if (e.Row.Table == null) { return; // removed row } if (row.IsDestUniqueNameNull() || row.DestUniqueName == "") { return; //unmatched row, nothing to validate } string srcObjectType = row.SourceUniqueName.Substring(0, row.SourceUniqueName.IndexOf(':', 0)); string destObjectType = row.DestUniqueName.Substring(0, row.DestUniqueName.IndexOf(':', 0)); if (srcObjectType != destObjectType) { MessageBox.Show(string.Format("{0} to {1} mapping error: ObjectType mismatch", row.SourceUniqueName, row.DestUniqueName)); row.DestUniqueName = ""; } }