Ejemplo n.º 1
0
        private static string BuildMultiSelectFilterCommandText(DaxFilterCollection daxFilterDic, DaxDrill.Tabular.TabularHelper tabular)
        {
            string commandText = "";

            foreach (var pair in daxFilterDic)
            {
                List <DaxFilter> daxFilterList = pair.Value;
                string           tableName     = daxFilterList[0].TableName;

                if (commandText != "")
                {
                    commandText += ",\n";
                }

                string childCommandText = "";
                foreach (var item in daxFilterList)
                {
                    if (childCommandText != "")
                    {
                        childCommandText += " || ";
                    }
                    else
                    {
                        childCommandText = "FILTER ( " + tableName + ", ";
                    }

                    var table = tabular.GetTable(item.TableName);

                    childCommandText += BuildColumnCommandText(table, item);
                }

                commandText += childCommandText + " )";
            }
            return(commandText);
        }
Ejemplo n.º 2
0
        private static string BuildSingleSelectFilterCommandText(Dictionary <string, string> excelDic, DaxDrill.Tabular.TabularHelper tabular, IEnumerable <string> pivotFieldNames)
        {
            List <DaxFilter> daxFilterList = ConvertSingleExcelDrillToDaxFilterList(excelDic, pivotFieldNames);

            string commandText = "";

            foreach (var item in daxFilterList)
            {
                if (commandText != "")
                {
                    commandText += ",\n";
                }
                if (item.IsHierarchy)
                {
                    commandText += "FILTER ( " + item.TableName + ",";
                }
                var table = tabular.GetTable(item.TableName);
                commandText += BuildColumnCommandText(table, item);
                if (item.IsHierarchy)
                {
                    commandText += ")";
                }
            }
            return(commandText);
        }