Skip to main content
October 24, 2025
Question

Sample for Aggregate function MAX in QueryRecordType

  • October 24, 2025
  • 1 reply
  • 0 views

Hi All,

We have a simple requirement: a Record Type with ID (Primary Key), AccountID, and DataSeqNumber. I need to retrieve the MAX(DataSeqNumber) for a specific AccountID. The record type is AccountInfo. Could you share a sample code using a!queryRecordType with the Aggregate function "MAX"?

-Thanks in Advance.

    1 reply

    shubhama926776
    October 24, 2025

    Here you can find sample code

    a!queryRecordType(
      recordType: 
      /*Add Record Here*/,
      fields: a!aggregationFields(
        measures: {
          a!measure(
            function: "MAX",
            field: /*Add filter column here*/,
            alias: "taxAmount_max_measure1"
          )
        }
      ),
      filters: a!queryLogicalExpression(
        operator: "AND",
        filters: {
          a!queryFilter(
            field: /*Add aggregated column here*/,
            operator: "=",
            value: "123"
          )
        },
        ignoreFiltersWithEmptyValues: true
      ),
      pagingInfo: a!pagingInfo(
        startIndex: 1,
        batchSize: 1
      ),
      fetchTotalCount: true()
    )


    https://docs.appian.com/suite/help/25.3/Measure_Component.html