Esempio 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);
        }
Esempio n. 2
0
        // converts DaxFilter list to dictionary. Duplicate entries are removed.
        // This is done by moving each Dax Filter under a dictionary key
        // The flat data structure is converted to a tree structure
        public static DaxFilterCollection ConvertDaxFilterListToDictionary(
            List <DaxFilter> daxFilters, DaxFilterCollection dic)
        {
            foreach (var df in daxFilters)
            {
                List <DaxFilter> dicValue = null;

                // create dictionary element if it doesn't exist
                if (!dic.TryGetValue(df.Key, out dicValue))
                {
                    dicValue = new List <DaxFilter>();
                    dic.Add(df.Key, dicValue);
                }

                // add DaxFilter to dictionary element
                dicValue.Add(df);
            }
            return(dic);
        }
Esempio n. 3
0
        public static Dictionary <string, List <DaxFilter> > ConvertDaxFilterListToDictionary(List <DaxFilter> daxFilters)
        {
            var dic = new DaxFilterCollection();

            return(ConvertDaxFilterListToDictionary(daxFilters, dic));
        }