Skip to main content
December 1, 2021
Question

Populating a dynamic Operator(greater than,less than ,equal,etc..)

  • December 1, 2021
  • 5 replies
  • 0 views

Hi all,

i have two question 

1.can we select the dynamic operator : 

         for eg : if(1 ri!operator 2,"if true","if false")

              where operator will belike {">=","<","=",etc..} . which user select from site

2. can apply a query filter on an aggregated column 

eg: 

a!query(
    aggregation:
    a!queryAggregation(
      aggregationColumns: 
      {
        a!queryAggregationColumn(
          field: "zipcode",
          isGrouping: true
        ),
        a!queryAggregationColumn(
          field: "caseId",
          alias: "caseId_count",
          aggregationFunction: "COUNT"
        )
      }
    ),
    logicalexpression: a!queryLogicalExpression(
      operator: "AND",
      filters: {
        a!queryFilter(
          field: "caseId_count",
          operator: "<",
          value: 3
        )
      },
      ignoreFiltersWithEmptyValues: true
    )

5 replies

stewart.burchell
December 1, 2021
  1. Dynamic Operator - no, not in the way you describe. But you could implement a selection from, say, a drop-down and, for each selectable value you have a hard-coded piece of code that is brought into play e.g. use an if() statement to interrogate the value selected in the drop-down and then select the relevant code with the equivalent operator.
  2. You can apply a filter to any column, I believe the filter is applied first and then the aggregation after on the filtered result set
aravind.sAuthor
December 1, 2021

Thanks for the quick response 

But on the second point : 

my use case i need to group them based the country's zipcode and count the number of records available on each group, then filter out the record which count more than 3.

stewart.burchell
December 1, 2021

Ah, Ok, I misunderstood. You'd have to do this in two steps. The first to get the data that has the aggregated counts, and then pass that data through another expression to extract on those with count > 3.

Think of how you'd have to do this if you implemented this in the database. Firstly you'd create a view that included a derived  column called, say "CASE_COUNT" and then you'd have to run a SQL SELECT statement on that View with a WHERE CASE_COUNT > 3. Similarly you have to do this in two steps in Appian.