public static QueryDocument ToQueryDocument(this QueryBuilder source) { var result = new QueryDocument(); var match = new MatchDefinition(); match.Filters = source.AvailableFilters; var group = new GroupDefinition(); group.Measures = source.SelectedMeasures; group.Dimensions = source.SelectedSlicers; var project = group.ToProjectionDocument(); if (source.AvailableFilters.Any(x => x.AvailableFilterValues.Any(y => y.Active))) result.Pipeline.Add(match.ToMatchDocument()); result.Pipeline.Add(group.ToGroupDocument()); result.Pipeline.Add(project); return result; }
MatchDefinition GetMatchDefinition() { var mf = new FilterDefinition { Column = new DataColumnMetadata { ColumnName = "Job_Family", DataType = ColumnDataTypes.String } }; mf.AvailableFilterValues.Add(new FilterValue {Key = "Executive", Value = "Executive", Active=true}); var matchDefinition = new MatchDefinition(); matchDefinition.Filters.Add(mf); return matchDefinition; }