Try OpenEdge Now
skip to main content
Programming Interfaces
Database Administration Entity Interface Reference : ITenantGroup interface : ITenantGroup examples : Creating and editing a tenant group
 
Creating and editing a tenant group
The following code shows assignment of properties and creation of a new tenant group. The service's NewTenantGroup( ) factory method expects the name of the group. The Table, DefaultAllocation, and each of the Default*Area properties are all mandatory properties that need to be specified before the tenant group can be passed to the CreateTenantGroup( ) service method. The Default*Area properties are all defined as instances of IArea, which must be known to, and can be retrieved from, the service. This example sets the default allocation to "Immediate" in order to allocate the partitions according to the default areas when the tenant group is created:
define variable tenantgroup as ITenantGroup no-undo.

assign
  tenantgroup = service:NewTenantGroup("AcmeCustomer")
  tenantgroup:Table = service:GetTable("Customer")
  tenantgroup:DefaultAllocation = "Immediate"
  tenantgroup:Description = "This group is for the customer table for ACME.")
  tenantgroup:DefaultDataArea = service:GetArea("GeneralDataArea")
  tenantgroup:DefaultIndexArea = service:GetArea("FirstClassIndexArea")
  tenantgroup:DefaultLobArea = service:GetArea("GeneralLobArea").

service:CreateTenantGroup(tenantgroup).
All writeable properties except Table can be edited after the tenant group is created. The following code changes the DefaultDataArea setting and sets DefaultAllocation to "None" in order to be able to allocate partitions manually:
assign
  tenantgroup = service:GetTenantGroup("AcmeCustomer")
  tenantgroup:DefaultDataArea = service:GetArea("FirstClassDataArea")
  tenantgroup:DefaultAllocation = "None".

service:UpdateTenantGroup(tenantgroup).