Removing a server group

Removing a server group is done in much the same way that you remove other InfoObjects from the APS.

To remove a group
  1. Query for the group.
  2. Remove the group from the resultant InfoObjects collection.
  3. Commit the modified collection back to the APS.

For example, the following function removes a group when given its ID:

function DeleteServerGroup(IStore, ServerGroupId)

{

    var ServerGroups = IStore.Query("SELECT SI_SERVER_GROUP FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerGroupId);

    // Concatenate # with the ID and given it to the

    // Delete method. If you give it just the ID, it will

    // treat it as an array index and remove the wrong server.

    ServerGroups.Delete("#" + ServerGroupId);

    IStore.Commit(ServerGroups);

}

Note:    In this case, you can always delete the first InfoObject from the collection since you queried by the ID and IDs are unique in the APS. That is, only one object will ever be returned in the collection using this type of query.

Next: Retrieving the server groups.



Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com