Rendering different values based on count function

I have a constant that stores three different values. My table has a list of items, where the constant can be either pass, fail, or na. 

I want to have three different sections on a new interface where it will show one section as all items that are in value 1 from the constant. All items that are in value 2 and all that are in value 3. I am not sure exactly how to go about this? 

  Discussion posts and replies are publicly visible

Parents Reply Children
  • It might be even easier if you have the data coming from a database. You can set up your query to aggregate on the field you want to compare to the constant. Then, you can use wherecontains to find the count of the associated data. Here's an example:

    a!localVariables(
      local!query:a!queryEntity(
        entity: cons!<YOUR ENTITY HERE>,
        query: a!query(
          pagingInfo: a!pagingInfo(
            startIndex: 1,
            batchSize: -1
          ),
          aggregation: a!queryAggregation(
            aggregationColumns: {
              a!queryAggregationColumn(field: "<YOUR FIELD NAME HERE>", isGrouping: true),
              a!queryAggregationColumn(field: "id", aggregationFunction: "COUNT", alias: "count")
            }
          )
        )
      ),
      a!textField(
        label: "Count of Constant Value 1",
        readOnly: true,
        value: index(
          local!query.data.count,
          wherecontains(cons!<YOUR CONSTANT HERE>[1], touniformstring(local!query.data.<YOUR FIELD NAME HERE>)),
          0
        )
      )
    )

    In this example, I group by the field in the database to create the correct count. Then, I find whether that value exists in the output using wherecontains(). I can then find the associated count using the index() function.