How to filter out tuple sub-field elements by predicate
book
Article ID: KB0076150
calendar_today
Updated On:
Description
I have a list of tuples, where the schema for the tuple element has a field named 'status'. I would like to filter out any elements where status is 'inactive'. How can I accomplish this in Event Flow?
Resolution
Use the
filterlist() function, as defined in the Help under StreamBase Home > StreamBase References > StreamBase Expression Language Functions > (sub-heading) Simple Functions: Lists. For example, if the tuple list element has a Named Schema 'Customer' with sub-fields 'name' and 'status', you can filter out inactive entries in a Map operator using the following expression:
filterlist(input1.Customer, function notInactive(cust Customer) {cust.status != 'inactive'})
This expression creates a user-defined function, 'notInactive', which applies the predicate
cust.status != 'inactive'.
Issue/Introduction
How to filter out tuple sub-field elements by predicate
Feedback
thumb_up
Yes
thumb_down
No