Try OpenEdge Now
skip to main content
Programming Interfaces
Database Administration Entity Interface Reference : IPartitionPolicy interface : IPartitionPolicy examples : Creating a partition policy for an empty table
Creating a partition policy for an empty table
A policy for an empty table can be created without any details. The following code shows the creation of a new partition policy for an empty table:
define variable policy as IPartitionPolicy no-undo.
define variable tbl as ITable no-undo.

/* get the table from the service */
Tbl = Service:GetTable("Employee")
/* get a new empty policy from the service */
policy = Service:NewPartitionPolicy("EmployeePolicy")
policy:Description = "Employee department partition")
policy:DefaultDataArea = Service:GetArea("Area1")
policy:DefaultIndexArea = Service:GetArea("Area1Idx").
policy:DefaultLobArea = Service:GetArea("Area1Lob")
policy:DefaultAllocation = "None"
    policy:HasRange = true
    policy:Table = tbl
/* add the field to the policy - found on the table */
The services NewPartitionPolicy( ) method expects the name of the policy. The default allocation and default areas are all mandatory properties. The default areas are defined as instances of IArea( ), which are retrieved from the service. The Table property must also be set before the policy can be submitted to the service. The HasRange and DefaultAllocation properties must also be set before the creation, but these have valid default values and may not need to be set in code.
The example above creates a list partition on the employee table on the department key, and sets the default allocation to "None" to allocate the partitions manually later.
Note: You are not allowed to add any data to this table yet since no partition policy details are added to the table.