Areas (creating and reading)

The following code shows how to use the API service to create and read an area using the IArea interface. The area cannot be deleted from the database after it has been created and consequently the service has no delete method:

define variable area as IArea no-undo.

area = service:NewArea("MyArea").
/* Set properties and add extents */
. . .
service:CreateArea(area).
Note: Creation is only supported on a local connection.

The properties cannot be edited after creation, but the update method is used to add extents to the area:

area = service:GetArea("MyArea").
/* Add extents */
. . . 
service:UpdateArea(area).

It is also possible to retrieve a collection of areas in the database from the service and create areas and/or add extent to the areas in the IAreaSet collection before passing the collection to the service:

define variable areas as IAreaSet no-undo.
define variable area as IArea no-undo.

areas = service:Areas().
 
area = service:NewArea("OrderArea").
/* Set properties and add extents */
. . .
areas:Add(area).

area = areas:Find("InventoryArea").
/* Add extents */
. . .

service:UpdateArea(areas).

For more information on the: