Documentation Center

  • Trial Software
  • Product Updates

clonegroup

Clone group into new private group on same client

Syntax

NewGObj = clonegroup(GObj,'NewName')

Description

NewGObj = clonegroup(GObj,'NewName') clones the dagroup object specified by GObj, making a private group NewGObj with name NewName. NewName must be a unique group name. GObj can be a private group or a public group.

The new group NewGObj is independent of the original group, but with the same parent (opcda object) and the same items as that group. All the group and item properties are duplicated with the exception of the following:

  • The Active property is configured to 'off'.

  • The GroupType property is configured to 'private'.

Not all OPC data access servers support the cloning of groups. To use this functionality, your server must support public groups. If you try to clone a group on a server that does not support public groups, an error is generated. To verify that a server supports public groups, use the opcserverinfo function on the client connected to that server: Look for an entry 'IOPCPublicGroups' in the 'SupportedInterfaces' field.

You use clonegroup primarily when you want to create a private duplicate of a public group that you can then modify. If you want to create a copy of a group in another client, use the copyobj function.

Examples

Create a fictitious client and configure a group with two items. Do not connect to the server.

da = opcda('localhost', 'Dummy.Server');
grp1 = addgroup(da, 'OriginalGroup');
itm1 = additem(grp1, 'Device1.Item1');
itm2 = additem(grp1, 'Device1.Item2');

Clone the group:

grp2 = clonegroup(grp1, 'ClonedGroup');

See Also

|

Was this topic helpful?