public static HierarchyRow Load(AdomdDataReader dataReader) { // Traverse the response and // read column 2, "CUBE_NAME" // read column 3, "DIMENSION_UNIQUE_NAME" // read column 21, "HIERARCHY_IS_VISIBLE" // read column 5, "HIERARCHY_UNIQUE_NAME" // read column 4, "HIERARCHY_NAME" //Don't use the hierarchy caption (prefer the hierarchy name) because for role-playing dimensions the copation wille the NameOfRolePlayingDimension.NameOfHieiarchy // read column 23, "HIERARCHY_DISPLAY_FOLDER" // Get the column value string perspectiveName = (string)dataReader.GetValue(2); if (!perspectiveName.StartsWith("$") && (bool)dataReader.GetValue(21)) { if (true) //Needed to avoid dimension [Measure] previously filtered { // Get the columns value var row = new HierarchyRow(); row.PerspectiveName = perspectiveName; row.DimensionUniqueName = (string)dataReader.GetValue(3); row.UniqueName = (string)dataReader.GetValue(5); row.Caption = (string)dataReader.GetValue(4); row.DisplayFolder = (string)dataReader.GetValue(23); return(row); } } else { return(null); } }
internal new IEnumerable <HierarchyRow> Discover(IEnumerable <IFilter> filters) { Filters = filters; var hierarchies = new List <HierarchyRow>(); Inform("Investigating hierarchies"); using (var cmd = CreateCommand()) { var adomdFiltering = Build(filters); cmd.CommandText = string.Format("SELECT * FROM $system.mdschema_hierarchies where 1=1 {0}", adomdFiltering); var rdr = ExecuteReader(cmd); while (rdr.Read()) { var hieRow = HierarchyRow.Load(rdr); if (PostFilter(hieRow)) { if (hieRow != null) { hierarchies.Add(hieRow); } } } } return(hierarchies); }
public static HierarchyRow Load(AdomdDataReader dataReader) { // Traverse the response and // read column 2, "CUBE_NAME" // read column 3, "DIMENSION_UNIQUE_NAME" // read column 21, "HIERARCHY_IS_VISIBLE" // read column 5, "HIERARCHY_UNIQUE_NAME" // read column 4, "HIERARCHY_NAME" //Don't use the hierarchy caption (prefer the hierarchy name) because for role-playing dimensions the copation wille the NameOfRolePlayingDimension.NameOfHieiarchy // read column 23, "HIERARCHY_DISPLAY_FOLDER" // Get the column value string perspectiveName = (string)dataReader.GetValue(2); if (!perspectiveName.StartsWith("$") && (bool)dataReader.GetValue(21)) { if (true) //Needed to avoid dimension [Measure] previously filtered { // Get the columns value var row = new HierarchyRow(); row.PerspectiveName = perspectiveName; row.DimensionUniqueName = (string)dataReader.GetValue(3); row.UniqueName = (string)dataReader.GetValue(5); row.Caption = (string)dataReader.GetValue(4); row.DisplayFolder = (string)dataReader.GetValue(23); return row; } } else return null; }
/// <summary> /// PostFilter method is specifically build to enable filter aftare the execution of the command. /// For some attributes such as Display-Folder you cannot apply a filter in the command, in this case the filter is applied on the resultset /// </summary> /// <param name="row"></param> /// <returns></returns> protected bool PostFilter(HierarchyRow row) { foreach (var postCommandFilter in PostCommandFilters) { if (!postCommandFilter.Evaluate(row)) { return(false); } } return(true); }
/// <summary> /// PostFilter method is specifically build to enable filter aftare the execution of the command. /// For some attributes such as Display-Folder you cannot apply a filter in the command, in this case the filter is applied on the resultset /// </summary> /// <param name="row"></param> /// <returns></returns> protected bool PostFilter(HierarchyRow row) { foreach (var postCommandFilter in PostCommandFilters) if (!postCommandFilter.Evaluate(row)) return false; return true; }