protected override string?PropertyValidation(PropertyInfo pi) { if (pi.Name == nameof(Token)) { if (Token == null) { return(!scriptColumn.IsOptional ? ChartMessage._0IsNotOptional.NiceToString().FormatWith(scriptColumn.DisplayName) : null); } if (!ChartUtils.IsChartColumnType(Token.Token, ScriptColumn.ColumnType)) { return(ChartMessage._0IsNot1.NiceToString().FormatWith(DisplayName, ScriptColumn.ColumnType)); } } return(base.PropertyValidation(pi)); }
protected override string PropertyValidation(PropertyInfo pi) { if (pi.Name == nameof(Token)) { if (Token == null) { return(!scriptColumn.IsOptional ? ChartMessage._0IsNotOptional.NiceToString().FormatWith(scriptColumn.DisplayName) : null); } if (parentChart.GroupResults) { if (scriptColumn.IsGroupKey) { if (Token.Token is AggregateToken) { return(ChartMessage._0IsKeyBut1IsAnAggregate.NiceToString().FormatWith(scriptColumn.DisplayName, DisplayName)); } } else { if (!(Token.Token is AggregateToken)) { return(ChartMessage._0ShouldBeAnAggregate.NiceToString().FormatWith(scriptColumn.DisplayName, DisplayName)); } } } else { if (Token.Token is AggregateToken) { return(ChartMessage._0IsAnAggregateButTheChartIsNotGrouping.NiceToString().FormatWith(DisplayName)); } } if (!ChartUtils.IsChartColumnType(token.Token, ScriptColumn.ColumnType)) { return(ChartMessage._0IsNot1.NiceToString().FormatWith(DisplayName, ScriptColumn.ColumnType)); } } return(base.PropertyValidation(pi)); }
public bool IsCompatibleWith(IChartBase chartBase) { if (GroupBy == GroupByChart.Always && !chartBase.GroupResults) { return(false); } if (GroupBy == GroupByChart.Never && chartBase.GroupResults) { return(false); } return(Columns.ZipOrDefault(chartBase.Columns, (s, c) => { if (s == null) { return c.Token == null; } if (c == null || c.Token == null) { return s.IsOptional; } if (!ChartUtils.IsChartColumnType(c.Token.Token, s.ColumnType)) { return false; } if (c.Token.Token is AggregateToken) { return !s.IsGroupKey; } else { return s.IsGroupKey || !chartBase.GroupResults; } }).All(a => a)); }
public bool CompatibleWith(QueryToken?token) { return(TypeFilter == null || token != null && ChartUtils.IsChartColumnType(token, TypeFilter.Value)); }