Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        /// <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);
        }
Exemplo n.º 5
0
        /// <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;
        }