I would like to know how can I filter on grouped data in Foundry Functions. I already managed to group and aggregate on my data, see below:
@Function()
public async grouping(lowerBound : Integer ): Promise<TwoDimensionalAggregation<string>> {
let grouping = Objects.search()
.HospitalLosAnalysis()
.groupBy(val => val['primaryHospitalName'].topValues())
.count()
//FILTER SHOULD BE HERE
return grouping
}
Now, I would like to filter only on rows, where the count is bigger than parameter lowerBound
. The problem is I am not able to filter anymore as the grouping returns a TwoDimensionalAggregation
, on which I am not able to filter anymore.
Some context: I would like to create a chart in Workshop where the user would be able to look only at hospitals with a significant count. He would input the lowerBound
parameter in a textbox, and the function would remove all of the rows that are smaller than lowerBound
.