- Index
- »
- axon
- »
- func:filter
def
func:filter
filter(val, filterExpr)
Apply a filter expression to a collection of dicts. The collection value may be any of the following:
- Grid: returns new grid with filtered rows
- Dict[]: returns list of filtered dicts (nulls are filtered out)
- Col[]: returns list of columns filtered by their meta
- Stream: filters stream of Dicts - see Streams
The filter parameter may one fo the following:
- Axon expression which maps to a filter
- Filter from
parseFilter()
- Filter from
parseSearch()
Examples:
// apply to a list of dicts [{v:1}, {v:2}, {v:3}, {v:4}].filter(v >= 3) // apply to a grid and return new grid with matching rows readAll(equip).filter(meter) // apply to a list of columns read(ahu).toPoints.hisRead(yesterday).cols.filter(kind=="Bool") // apply to a stream of dicts readAllStream(equip).filter(siteMeter and elec and meter).collect // apply search filter readAll(equip).filter(parseSearch("RTU-1"))