Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Filtering and sorting : Filtering on a child collection using the RequestInfo class
 
Filtering on a child collection using the RequestInfo class
To filter requested objects using the RequestInfo class, you instantiate the RequestInfo class using filter parameters and access the instance as the IRequestInfo interface type. Constructors for the RequestInfo class allow you to specify filters on child collections of requested objects for all Get*( ) methods that return an object that has child collections. The top instance represents the requested object and the child instances are added using an Add( ) method for the collection that is to be filtered.
You must specify a unique key name and value for an IRequestInfo instance that you use with Get*( ) methods that return a single IDataAdminElement. To specify criteria for a collection, you specify the collection name using the single parameter constructor and assign the query to the QueryString property.
The following code example shows the retrieval of a single tenant with a filter on disabled domains:
define variable requestInfo as IRequestInfo no-undo.
define variable childInfo as IRequestInfo no-undo.
define variable tnt as ITenant no-undo.

requestInfo = new RequestInfo("Name","ABXTenant").
childInfo = new RequestInfo("Domains").
childInfo:QueryString = ("IsEnabled = 'false'").
requestInfo:Add(childInfo).
tnt = service:GetTenant(requestInfo).
The following code example shows how to use of the IRequestInfo object to retrieve a collection of non-allocated tenants with disabled domains (similar to the previous example). In this case, all the retrieved tenants will only have domains that satisfy the filter criteria. Note that you need an IRequestInfo object for the top level even if you don't want to filter the top collection, as with the tenants this case. IRequestInfo children are only added for the child collections that need a filter:
define variable requestInfo as IRequestInfo no-undo.
define variable childInfo as IRequestInfo no-undo.
define variable tntSet as ITenantSet no-undo.

requestInfo = new RequestInfo("Tenants").
requestInfo:QueryString = ("IsAllocated = 'false'").
childInfo = new RequestInfo("Domains").
childInfo:QueryString = ("IsEnabled = 'false'").
requestInfo:Add(childInfo).
tntSet = service:GetTenants(requestInfo).
The IRequestInfo interface defines several public properties and methods that you can use to manage entity and collection sorting and filtering.
* IRequestInfo interface properties
* IRequestInfo interface methods