Try OpenEdge Now
skip to main content
Programming Interfaces
Change Data Capture ABL references : Code examples : Get CDC policies
 

Get CDC policies

The following code is an example for listing CDC table policies:
using OpenEdge.DataAdmin.Error.DataAdminErrorHandler from propath.
using OpenEdge.DataAdmin.ICdcTablePolicy from propath.
using OpenEdge.DataAdmin.ICdcTablePolicyset from propath.
using OpenEdge.DataAdmin.ICdcFieldPolicySet from propath.
using OpenEdge.DataAdmin.ICdcFieldPolicy from propath.
using OpenEdge.DataAdmin.Lang.Collections.IIterator from propath.

define variable service as OpenEdge.DataAdmin.DataAdminService no-undo.
define variable errorHandler as DataAdminErrorHandler no-undo.
define variable tablePolicy as ICdcTablePolicy no-undo.
define variable tablePolicies as ICdcTablePolicyset no-undo.
define variable FieldPolicies as ICdcFieldPolicyset no-undo.
define variable FieldPolicy as ICdcFieldPolicy no-undo.
define variable iter AS IIterator no-undo.

service = new OpenEdge.DataAdmin.DataAdminService(ldbname(1)).

/* get policy based on policy name */
tablePolicy = service:GetCdcTablePolicy("Invoiceactive").
FieldPolicies = tablePolicy:FieldPolicies.
fieldpolicy = FieldPolicies:Find("id").

/* get all policies */
tablePolicies = service:GetCdcTablePolicies().


/* get policy set based on filter */
tablePolicies = service:GetCdcTablePolicies("TableName= ~"Customer~"").

iter = tablePolicies:Iterator().
do while iter:HasNext():
tablepolicy = cast(iter:Next(), ICdcTablePolicy).
message tablePolicy:Name view-as alert-box.
end.