How to add MAX() database aggregation function inside appian queryEntity() function?

Certified Senior Developer

Hi,

I want to execute a query like "SELECT MIN(Price) AS SmallestPrice FROM Products;"  in queryEntity() . How can I do that?

  Discussion posts and replies are publicly visible

Parents Reply
  • 0
    Certified Lead Developer
    in reply to sudip.das005

    Basically you define an a!queryAggregationColumn() with the "field" set to i.e. "Price", and "aggregationFunciton" set to "MAX" (or "MIN" per your original post).  You can optionally specify an "alias" to name the resulting aggregation something more appropriate (like "MinPrice").

    Note that you must also define a grouping column.  This is basically like having a WHERE clause in your SQL, mapping to an absolute value of some other column.  An easy example would be like "SELECT MIN(Price) AS SmallestPrice FROM Products WHERE IsActive = TRUE;".

Children
No Data