Try OpenEdge Now
skip to main content
Programming Interfaces
Data Management : ABL API for Multi-tenant and Table Partition Management : Maintaining multi-tenant and table partition entities : Working with Partitions
 
Working with Partitions
The IPartitionPolicyDetail partition collection property exposes partitions for the table partition detail. The property returns IPartitionMap. This is mapped using the ISchemaElement (table, index or field) as key.
The following code illustrates how to allocate partitions of an existing policy to different areas:
block level on error undo, throw.
using OpenEdge.DataAdmin.*.
using OpenEdge.DataAdmin.Lang.Collections.*.

define variable service as DataAdminService no-undo.

define variable tableImpl as ITable no-undo.
define variable iterator as IIterator no-undo.
define variable iterator2 as IIterator no-undo.
define variable partition as IPartition no-undo.
define variable policy as IPartitionPolicy no-undo.
define variable detail as IPartitionPolicyDetail no-undo.
define variable areaNameSuffix as character no-undo.

assign
service = new DataAdminService("Sports2000")
policy = service:GetPartitionPolicy("EmployeePartition").
iterator = policy:Details:Iterator().
do while iterator:HasNext():
detail = cast(iterator:Next(),IPartitionPolicyDetail).

/** This is assuming that you have created 3 areas for each detail */
areaNameSuffix = "-" + detail:name.
iterator2 = detail:Partitions:Iterator().
do while iterator2:HasNext():
partition = cast(iterator2:Next(),IPartition).
case partition:ObjectType:
when "Table" then
do:
partition:Area = service:GetArea("DataArea" + areaNameSuffix).
end.
when "Index" then
do:
partition:Area = service:GetArea("IndexArea" + areaNameSuffix).
end.
when "Field" then
do:
partition:Area = service:GetArea("LobArea" + areaNameSuffix).
end.
end case.
end.
detail:Allocate().
end.

service:UpdatePartitionPolicy(policy).
* Splitting a Partition