コード例 #1
0
        public static string CreatePivotFieldPageName(string pivotFieldName, string currentPageName)
        {
            string column = DaxDrillParser.GetColumnFromPivotField(pivotFieldName);
            string table  = DaxDrillParser.GetTableFromPivotField(pivotFieldName);

            return(string.Format("[{0}].[{1}].&[{2}]", table, column, currentPageName));
        }
コード例 #2
0
        public static List <DaxFilter> ConvertPivotCellMdxToDaxFilterList(string mdxString)
        {
            mdxString = mdxString.Trim();
            mdxString = mdxString.Substring(1, mdxString.Length - 2);
            string[] itemStringArray = mdxString.Split(',');
            for (int i = 0; i < itemStringArray.Length; i++)
            {
                itemStringArray[i] = itemStringArray[i].Trim();
            }

            itemStringArray = itemStringArray.Where(x =>
            {
                // exclude the measure as it's not a DAX filter
                if (x.Substring(0, 10) == "[Measures]")
                {
                    return(false);
                }
                return(true);
            }).ToArray();

            var result = new List <DaxFilter>();

            foreach (string itemString in itemStringArray)
            {
                var daxFilter = DaxDrillParser.CreateDaxFilterFromHierarchy(itemString, null);
                result.Add(daxFilter);
            }

            return(result);
        }
コード例 #3
0
        public DataTable ExecuteTable(string qry, ADOMD.AdomdConnection cnn)
        {
            ADOMD.AdomdDataAdapter dataAdapter = new ADOMD.AdomdDataAdapter(qry, cnn);
            DataTable tabularResults           = new DataTable();

            dataAdapter.Fill(tabularResults);
            foreach (System.Data.DataColumn column in tabularResults.Columns)
            {
                column.ColumnName = DaxDrillParser.RemoveBrackets(column.ColumnName);
            }

            return(tabularResults);
        }
コード例 #4
0
        public static List <DaxFilter> ConvertPivotTableMdxToDaxFilterList(string mdxString, IEnumerable <string> pivotFieldNames)
        {
            var mdxParser = new TableMdxParser(mdxString);

            string[] columnStringArray = mdxParser.ConvertColumnMdxToArray();

            string[] rowStringArray = mdxParser.ConvertRowMdxToArray();

            var result = new List <DaxFilter>();

            foreach (string itemString in columnStringArray)
            {
                var daxFilter = DaxDrillParser.CreateDaxFilterFromHierarchy(itemString.Trim(), pivotFieldNames);
                result.Add(daxFilter);
            }
            foreach (string itemString in rowStringArray)
            {
                var daxFilter = DaxDrillParser.CreateDaxFilterFromHierarchy(itemString.Trim(), pivotFieldNames);
                result.Add(daxFilter);
            }

            return(result);
        }