|
@@ -162,12 +162,7 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon |
|
@@ -162,12 +162,7 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon |
162
|
}
|
162
|
}
|
163
|
if queryComponent.Aggregation != nil {
|
163
|
if queryComponent.Aggregation != nil {
|
164
|
res.DatabaseTableName = queryComponent.MasterTable.SQLName
|
164
|
res.DatabaseTableName = queryComponent.MasterTable.SQLName
|
165
|
- for i, f := range queryComponent.Aggregation.ValueFields {
|
|
|
166
|
- tableField, ok := table.MatchField(&domain.Field{Name: f.DisplayName})
|
|
|
167
|
- if !ok {
|
|
|
168
|
- continue
|
|
|
169
|
- }
|
|
|
170
|
- if i == 0 {
|
165
|
+ if len(queryComponent.Aggregation.ValueFields)>0 || len(queryComponent.Aggregation.RowFields)>0{
|
171
|
res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{
|
166
|
res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{
|
172
|
DatabaseTableName: queryComponent.MasterTable.SQLName,
|
167
|
DatabaseTableName: queryComponent.MasterTable.SQLName,
|
173
|
FieldSchema: NewFieldSchemaFromField(&domain.Field{
|
168
|
FieldSchema: NewFieldSchemaFromField(&domain.Field{
|
|
@@ -179,6 +174,11 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon |
|
@@ -179,6 +174,11 @@ func NewFormulaCalculate(table *domain.Table, queryComponent *domain.QueryCompon |
179
|
CalculateFieldName: "id",
|
174
|
CalculateFieldName: "id",
|
180
|
})
|
175
|
})
|
181
|
}
|
176
|
}
|
|
|
177
|
+ for _, f := range queryComponent.Aggregation.ValueFields {
|
|
|
178
|
+ tableField, ok := table.MatchField(&domain.Field{Name: f.DisplayName})
|
|
|
179
|
+ if !ok {
|
|
|
180
|
+ continue
|
|
|
181
|
+ }
|
182
|
res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{
|
182
|
res.FormulaCalculateFields = append(res.FormulaCalculateFields, &FormulaCalculateField{
|
183
|
DatabaseTableName: queryComponent.MasterTable.SQLName,
|
183
|
DatabaseTableName: queryComponent.MasterTable.SQLName,
|
184
|
FieldSchema: NewFieldSchemaFromField(f.Field),
|
184
|
FieldSchema: NewFieldSchemaFromField(f.Field),
|