book
Article ID: KB0076744
calendar_today
Updated On:
Description
I have a list..
[1,2,3,4,5,4,4,5]
..and I would like to count how many elements match the value 4.
Issue/Introduction
This article describes how to get a count of list elements that match a certain value.
Resolution
To get this value, you can use a combination of length() and filterlist() functions in a Map operator, as described in the Help under
Home > StreamBase References > StreamBase Expression Language Functions. For example..
length(filterlist(input1.ListOfInts, function myrange(x int) { x == 4} ))
..where 'ListOfInt' is the input list field going into the Map operator.