Esempio n. 1
0
        public bool IsDatabaseCompatible(string connString)
        {
            var  cnnStringBuilder = new TabularConnectionStringBuilder(connString);
            bool result           = false;

            using (var tabular = new DaxDrill.Tabular.TabularHelper(
                       cnnStringBuilder.DataSource,
                       cnnStringBuilder.InitialCatalog))
            {
                tabular.Connect();
                result = tabular.IsDatabaseCompatible;
                tabular.Disconnect();
            }
            return(result);
        }
Esempio n. 2
0
        private TabularItems.Measure GetMeasure(Excel.Range rngCell)
        {
            var cnnBuilder = new TabularConnectionStringBuilder(this.connectionString);

            string measureName = GetMeasureName(rngCell);

            TabularItems.Measure measure = null;
            using (var tabular = new DaxDrill.Tabular.TabularHelper(cnnBuilder.DataSource, cnnBuilder.InitialCatalog))
            {
                tabular.Connect();
                measure = tabular.GetMeasure(measureName);
                tabular.Disconnect();
            }
            return(measure);
        }
Esempio n. 3
0
        public string GetDAXQuery(string connString)
        {
            string commandText = "";

            var cnnStringBuilder = new TabularConnectionStringBuilder(connString);

            int maxRecords    = ExcelHelper.GetMaxDrillthroughRecords(rngCell);
            var detailColumns = GetCustomDetailColumns(rngCell);

            using (var tabular = new DaxDrill.Tabular.TabularHelper(
                       cnnStringBuilder.DataSource,
                       cnnStringBuilder.InitialCatalog))
            {
                tabular.Connect();

                // use Table Query if it exists
                // otherwise get the Table Name from the Measure

                string tableQuery = GetCustomTableQuery(rngCell);

                if (string.IsNullOrEmpty(tableQuery))
                {
                    // if table not defined in XML metadata, retrieve entire table
                    string measureName = GetMeasureName(rngCell);
                    commandText = DaxDrillParser.BuildQueryText(tabular,
                                                                pivotCellDic,
                                                                measureName, maxRecords, detailColumns, pivotFieldNames);
                }
                else
                {
                    // if table is defined in XML metadata, retrieve using DAX command
                    commandText = DaxDrillParser.BuildCustomQueryText(tabular,
                                                                      pivotCellDic,
                                                                      tableQuery, maxRecords, detailColumns, pivotFieldNames);
                }

                tabular.Disconnect();
            }

            return(commandText);
        }