How to make a sum from an aggregate queryEntity ?

Certified Senior Developer

Hi,

I'm trying to make a simple SUM query but it does not return what I need.

The query returns a datasubset with 2 lines (quantities: 45 and 46), but I was expecting the query to return 91.
(I would like to avoid using the sum() function in this example).

Could you tell me what is missing please ?

  a!queryEntity(
    entity: cons!CJT_VEHICLES,
    fetchTotalCount: true,
    query: a!query(
      aggregation: a!queryAggregation(
        aggregationColumns: {
          a!queryAggregationColumn(
            field: "quantity",
            alias: "quantity",
            aggregationFunction: "SUM",
            isGrouping: true
          )
        }
      ),
      logicalExpression: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: "type",
            operator: "=",
            value: ri!typeId
          )
        },
        ignoreFiltersWithEmptyValues: true,
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: -1
      )
    )
  )

  Discussion posts and replies are publicly visible