Removing a group associate from a server group

Removing an associate from a group is similar to adding one. You use ServerGroup.SubGroups.Delete to remove the associate and call InfoStore.Commit to save the changes to the APS. The Delete method's parameter, however, is used differently to that of Add. In this case you can either given the index of the server within the Servers.Item array, or you can given a the ID of the server Group that is the associate. The following function deletes a given server from a given group.

Example

function DeleteGroupAssociate(IStore, ServerGroupId, GroupID)

    var ServerGroups = IStore.Query

    ("SELECT SI_SUBGROUPS FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerGroupId);

    ServerGroup = ServerGroups.Item(1).PluginInterface("");

    // 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 group associate.

    ServerGroup.SubGroups.Delete("#" + GroupID);

    IStore.Commit(ServerGroups);

}

Next: Clearing all group associates from a server group.



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