How to Filter Items when Browsing a Data Source

As mentioned in the previous section, it can be problematic to browse an entire OPC DA datasource namespace without first applying a filter to the browsing process. Allowances for filtering on both the server and client side are possible using system:inmation and can be configured using DataStudio. In this section an easy way to apply a server side filter will be explained. The client side filtering options will be explained in the next section which covers the creation and implementation of Rule objects.

Applying Branch and Leaf Filters to OPC DA Data Source Browsing

The server side browse filters are applied to the namespace of OPC DA data sources, meaning that data item objects can be filtered by Object Name. This filtering can take place at the Branch or Leaf level of the object tree.

This example will demonstrate both the Branch and Leaf browse filters

  • Firstly add a connector to the Core using the method described earlier (See Adding a Connector). You can also use a preexisting Connector for this example, however, to simulate a pre-browsed state you should first delete the children items from the OPC DA data source. Use the context menu and select Admin → Delete → Children.

Deleting Children from a Data Source
Figure 1. Deleting Children from a Data Source
  • Browse the Data Source once and note the items present in the full namespace then once more delete the children of the data source to return to the pre-browsed state

  • Select the OPC DataSource and in the Object Properties panel expand this branch Server  COM Connection  OPC Client Options  Browse Control for the data source.

Browse Control - Object Properties Panel
Figure 2. Browse Control - Object Properties Panel

In the Browse Control options there are various configurable controls for the browsing operation. The Branch and Leaf filter fields allow you to filter to return only items from the data source namespace containing a certain string value.

  • Enter "i*" into the Branch Filter field and click Apply. Browse the data source once.

  • In the discovered items in the namespace, only the Branch items beginning with "i" should be returned. In this example only the "increment" folder is browsed. Expanding the folder reveals all the data item objects beneath it.

Branch Filter Browsing of an OPC DA data source
Figure 3. Branch Filter Browsing of an OPC DA data source
  • Delete the children of the data source again to restore it to a pre-browsed state.

  • In the Object Properties panel of the OPC DA data source, type "I*" into the Leaf filter field and click Apply.

Branch and Leaf Filter options in Object Properties Panel
Figure 4. Branch and Leaf Filter options in Object Properties Panel
  • Browse the data source once and expand the returned branch folder to view the discovered items beneath it.

Branch and Leaf filters applied to OPC DA Data Source Browsing
Figure 5. Branch and Leaf filters applied to OPC DA Data Source Browsing

The Branch and Leaf filters applied to the browse return only the "increment" folder (indicated in the Branch Filter) and then only the data item objects in the "increment" folder namespace that begin with "I" (indicated by the Leaf filter).

  • Next, return the OPC DA data source to its pre-browsed state by deleting its children. Remove the Branch Filter in the Object Properties panel by deleting the contents of the field, but leaving the Leaf Filter in place. Click Apply.

  • Browse the data source again. With only the Leaf Filter applied all the Branch folders are discovered but only data item objects in the namespace covered by the filter are returned (item names containing "I" in the namespace).

Leaf Filter Applied to OPC DA Data Source Browsing
Figure 6. Leaf Filter Applied to OPC DA Data Source Browsing

Effective use of Branch and Leaf filters allows for selective browsing of an OPC DA data source namespace on the server side. The next section will explain how to apply Rules to filter browsing on the client side.

Training Task: Vary the Branch and Leaf filter terms Try entering different terms into the Branch and Leaf filter fields to control the browsing the namespace of the data source.
Leaf and Branch filtering options are only available for OPC DA servers. OPC UA servers do not offer server side browse filters for the namespace. The next section demonstrates the use of Rule objects that allow you to control both OPC DA and OPC UA namespace browsing on the client side.