Ejemplo n.º 1
0
        internal new IEnumerable <MeasureRow> Discover(IEnumerable <IFilter> filters)
        {
            var measures = new List <MeasureRow>();

            Inform("Investigating measures");

            using (var cmd = CreateCommand())
            {
                var adomdFiltering = Build(filters);
                cmd.CommandText = string.Format("SELECT * FROM $system.mdschema_measures WHERE MEASURE_IS_VISIBLE and LEN(MEASUREGROUP_NAME)>0{0}", adomdFiltering);
                var rdr = ExecuteReader(cmd);


                while (rdr.Read())
                {
                    var row = MeasureRow.Load(rdr);
                    if (PostFilter(row))
                    {
                        if (row != null)
                        {
                            measures.Add(row);
                        }
                    }
                }
            }

            return(measures);
        }
Ejemplo n.º 2
0
        public static MeasureRow Load(AdomdDataReader dataReader)
        {
            // Traverse the response and
            // read column 2, "CUBE_NAME"
            // read column 4, "MEASURE_UNIQUE_NAME"
            // read column 5, "MEASURE_CAPTION"
            // read column 18, "MEASUREGROUP_NAME"

            // Get the column value
            string perspectiveName = (string)dataReader.GetValue(2);
            if (!perspectiveName.StartsWith("$"))
            {
                // Get the column value
                var row = new MeasureRow();
                row.PerspectiveName = perspectiveName;
                row.MeasureGroupName = (string)dataReader.GetValue(18);
                row.UniqueName = (string)dataReader.GetValue(4);
                row.Caption = (string)dataReader.GetValue(5);
                row.DisplayFolder = (string)dataReader.GetValue(19);

                return row;
            }
            else
                return null;
        }
Ejemplo n.º 3
0
        public static MeasureRow Load(AdomdDataReader dataReader)
        {
            // Traverse the response and
            // read column 2, "CUBE_NAME"
            // read column 4, "MEASURE_UNIQUE_NAME"
            // read column 5, "MEASURE_CAPTION"
            // read column 18, "MEASUREGROUP_NAME"

            // Get the column value
            string perspectiveName = (string)dataReader.GetValue(2);

            if (!perspectiveName.StartsWith("$"))
            {
                // Get the column value
                var row = new MeasureRow();
                row.PerspectiveName  = perspectiveName;
                row.MeasureGroupName = (string)dataReader.GetValue(18);
                row.UniqueName       = (string)dataReader.GetValue(4);
                row.Caption          = (string)dataReader.GetValue(5);
                row.DisplayFolder    = (string)dataReader.GetValue(19);

                return(row);
            }
            else
            {
                return(null);
            }
        }
Ejemplo 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(MeasureRow row)
        {
            foreach (var postCommandFilter in PostCommandFilters)
            {
                if (!postCommandFilter.Evaluate(row))
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo 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(MeasureRow row)
        {
            foreach (var postCommandFilter in PostCommandFilters)
                if (!postCommandFilter.Evaluate(row))
                    return false;

            return true;
        }
Ejemplo n.º 6
0
 protected bool Evaluate(MeasureRow row)
 {
     return(this.Caption.Equals(row.DisplayFolder));
 }
Ejemplo n.º 7
0
 protected bool Evaluate(MeasureRow row)
 {
     return this.Caption.Equals(row.DisplayFolder);
 }