![](dotnetdiagramimages/OpcLabs_EasyOpcUA_OpcLabs_EasyOpc_UA_Filtering_UAFilterOperandCollection.png)
'Declaration
<ComDefaultInterfaceAttribute(OpcLabs.EasyOpc.UA.Filtering.ComTypes._UAFilterOperandCollection)> <ComVisibleAttribute(True)> <GuidAttribute("0D655E18-5E53-4869-809C-35DFFC307F8A")> <TypeConverterAttribute(System.ComponentModel.ExpandableObjectConverter)> <DefaultMemberAttribute("Item")> <DebuggerTypeProxyAttribute(System.Collections.Generic.Mscorlib_CollectionDebugView`1)> <DebuggerDisplayAttribute("Count = {Count}")> <SerializableAttribute()> Public NotInheritable Class UAFilterOperandCollection Inherits System.Collections.ObjectModel.Collection(Of UAFilterOperand) Implements OpcLabs.EasyOpc.UA.Filtering.ComTypes._UAFilterOperandCollection, System.Collections.Generic.ICollection(Of UAFilterOperand), System.Collections.Generic.IEnumerable(Of UAFilterOperand), System.Collections.Generic.IList(Of UAFilterOperand), System.Collections.Generic.IReadOnlyCollection(Of UAFilterOperand), System.Collections.Generic.IReadOnlyList(Of UAFilterOperand), System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Xml.Serialization.IXmlSerializable
'Usage
Dim instance As UAFilterOperandCollection
[ComDefaultInterface(OpcLabs.EasyOpc.UA.Filtering.ComTypes._UAFilterOperandCollection)] [ComVisible(true)] [Guid("0D655E18-5E53-4869-809C-35DFFC307F8A")] [TypeConverter(System.ComponentModel.ExpandableObjectConverter)] [DefaultMember("Item")] [DebuggerTypeProxy(System.Collections.Generic.Mscorlib_CollectionDebugView`1)] [DebuggerDisplay("Count = {Count}")] [Serializable()] public sealed class UAFilterOperandCollection : System.Collections.ObjectModel.Collection<UAFilterOperand>, OpcLabs.EasyOpc.UA.Filtering.ComTypes._UAFilterOperandCollection, System.Collections.Generic.ICollection<UAFilterOperand>, System.Collections.Generic.IEnumerable<UAFilterOperand>, System.Collections.Generic.IList<UAFilterOperand>, System.Collections.Generic.IReadOnlyCollection<UAFilterOperand>, System.Collections.Generic.IReadOnlyList<UAFilterOperand>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Xml.Serialization.IXmlSerializable
[ComDefaultInterface(OpcLabs.EasyOpc.UA.Filtering.ComTypes._UAFilterOperandCollection)] [ComVisible(true)] [Guid("0D655E18-5E53-4869-809C-35DFFC307F8A")] [TypeConverter(System.ComponentModel.ExpandableObjectConverter)] [DefaultMember("Item")] [DebuggerTypeProxy(System.Collections.Generic.Mscorlib_CollectionDebugView`1)] [DebuggerDisplay("Count = {Count}")] [Serializable()] public ref class UAFilterOperandCollection sealed : public System.Collections.ObjectModel.Collection<UAFilterOperand>, OpcLabs.EasyOpc.UA.Filtering.ComTypes._UAFilterOperandCollection, System.Collections.Generic.ICollection<UAFilterOperand>, System.Collections.Generic.IEnumerable<UAFilterOperand>, System.Collections.Generic.IList<UAFilterOperand>, System.Collections.Generic.IReadOnlyCollection<UAFilterOperand>, System.Collections.Generic.IReadOnlyList<UAFilterOperand>, System.Collections.ICollection, System.Collections.IEnumerable, System.Collections.IList, System.Xml.Serialization.IXmlSerializable
The Where clause contains the criteria limiting the notifications that the OPC UA server sends - and the OPC UA client receives. The Where clause in OPC UA is similar to the WHERE clause in SQL queries, with the difference that it operates on events and not on table rows: It is a filter that allows you to choose the events of interest, out of all events provided by the chosen notifier node in the OPC UA server. The OPC UA server itself controls which events are generated by the notifier (for particular types of events, this may be prescribed by OPC UA specifications or other standards). For example, the event might be triggered by a process value exceeding specific limit. In OPC UA, there is no generic way to influence which events get internally generated in the OPC UA server; but the Where clause allows you to pick the events that are of interest to your application.
Obviously, you can also do event filtering on the client side (in your application), and throw away the events that you do not need. But this approach requires all these events be transferred from the server to the client, which represents a load on all parts involved (server, network, client). Not all filtering criteria can be specified using the Where clause, but whenever you can, you should use it, because the filtering then occurs in the OPC UA server and close to the source, which greatly reduces the load on other parts of the system.
The Where clause of the event filter is represented using the UAContentFilterElement object. This objects contains the filter operand to be evaluated (the FilterOperator property, which is a UAFilterOperator enumeration), and the operands used by the selected operator (the FilterOperands property, which is a UAFilterOperandCollection). The UAFilterOperator enumeration contains all operators supported by OPC UA (Equals, IsNull, GreaterThan, LessThan, GreaterThanOrEqual, LessThanOrEqual, Like, Not, Between, InList, And, Or, Cast, InView, OfType, RelatedTo, BitwiseAnd, BitwiseOr). The UAFilterOperandCollection is a collection of content filter operands (UAFilterOperand).
The UAFilterOperand is a base class for four different types of filter operands: UAAttributeOperand (an operand consisting of an attribute of a node in a type, with optional relative path and alias), UAContentFilterElement (essentially, an operator with operands), UALiteralOperand (an operand consisting of a literal value), or UASimpleAttributeOperand (an operand consisting of an attribute of a node in a type, with optional simple relative path, and no alias).
In order to make the creation of Where clauses appear shorter in the code, a UAContentFilterElementBuilder class is provided. Instances of this builder can be implicitly converted to the content filter element itself (hence you can create just the UAContentFilterElementBuilder objects, and use them at all places where the UAContentFilterElement object is expected). The builder contains an operator and is a collection of operands; you can use the C# collection initializer to specify the operands.
For further simplification of the coding, the UAFilterElements static class provides an easy way to construct basic filter elements (literal, attribute, or a simple attribute), and elements with various operators. Using the UAFilterElements class is for most cases the recommended way to create the Where clause of the event filter. For example, UAFilterElements.GreaterThanOrEqual creates a Where clause with the ‘>=’ operator. There are methods for each of the OPC UA operators, with various overloads. The UAFilterElements.Attribute, UAFilterElements.Literal and UAFilterElements.SimpleAttribute methods can be used to create other types of filter elements. Moreover, useful overloads exist that assure that you can actually use .NET objects directly as values of operands, and they will be interpreted as literal elements. With use of all these code simplifying features, you can write, for example, the following Where clause:
UAFilterElements.GreaterThanOrEqual(UABaseEventObject.Operands.Severity, 500).
System.Object
System.Collections.ObjectModel.Collection<T>
OpcLabs.EasyOpc.UA.Filtering.UAFilterOperandCollection