Removing a server from a group

Removing a server from a group is similar to adding one. You use ServerGroup.Servers.Delete to remove the server 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 name of the server. The following function deletes a given server from a given group.

Example

function DeleteServerGroupMember(IStore, ServerGroupId, MemberName)

{

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

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

    ServerGroup.Servers.Delete(MemberName);

    IStore.Commit(ServerGroups);

}

Next: Clearing all servers from a group.



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