private EntitySchemaQueryColumn AddQueryColumn(JObject columnItem, string columnPath) { columnPath = DashboardDataUtils.ClearColumnPathSuffix(columnPath); string filterData = columnItem.Value <string>("serializedFilter"); string aggregationType = columnItem.Value <string>("aggregationType"); AggregationType columnAggregationType = AggregationType.None; if (!string.IsNullOrEmpty(aggregationType)) { columnAggregationType = (AggregationType)Enum.Parse(typeof(AggregationType), aggregationType); } EntitySchemaQueryColumn column; if (columnAggregationType != AggregationType.None && !string.IsNullOrEmpty(filterData)) { EntitySchemaQuery subQuery; column = Esq.AddColumn(columnPath, columnAggregationType.ToStrict(), out subQuery); var dashboardData = new BaseDashboardItemSelectBuilder(UserConnection, subQuery); dashboardData.AddFilterByJson(filterData); } else { column = Esq.AddColumn(columnPath); if (!string.IsNullOrEmpty(aggregationType)) { column.SummaryType = columnAggregationType; } } SetColumnOrder(columnItem, column); return(column); }
private void AddUseEmptyValuesFilters(BaseDashboardItemSelectBuilder builder, JToken serieParameters) { string column = serieParameters.Value <string>("xAxisColumn"); if (string.IsNullOrEmpty(column)) { column = builder.Esq.RootSchema.PrimaryColumn.ColumnValueName; } builder.Esq.Filters.Add(builder.Esq.CreateFilter(FilterComparisonType.IsNotNull, column)); }
private void SetChartFilters(BaseDashboardItemSelectBuilder builder, JToken serieParameters) { var useEmptyValue = Parameters.Value <string>("useEmptyValue"); if (useEmptyValue.IsNullOrEmpty() || useEmptyValue.Equals("False")) { AddUseEmptyValuesFilters(builder, serieParameters); } string filterData = serieParameters.Value <string>("filterData"); builder.AddFilterByJson(filterData); ApplySectionBindingFilter(builder, serieParameters); }
/// <summary> /// Applies filters by parent records. /// </summary> protected void ApplySectionBindingFilter(BaseDashboardItemSelectBuilder builder, JToken parameters = null) { if (parameters == null) { parameters = Parameters; } var sectionBindingColumn = parameters.Value <string>(SectionBindingColumnProperty); if (sectionBindingColumn.IsNotNullOrEmpty()) { builder.AddFilter(sectionBindingColumn, BindingColumnValue); } }