cancel
Showing results for 
Search instead for 
Did you mean: 

Copy Service

Former Member
0 Kudos

Hi

can any body assist me with a sample code to copy the elements from one node into another using copy service

rgds

Akeel

Accepted Solutions (1)

Accepted Solutions (1)

former_member214651
Active Contributor
0 Kudos

Hi,

WDCopyService.copyElements(wdContext().node<SourceNode>(), wdContext().node<TargetNode>());

WDCopyService.copyCorresponding(wdContext().node<SourceNode>().get<NodeName>ElementAt(i), wdContext().node<TargetNode>().get<NodeName>ElementAt(i));

But for these 2 API's to run, the name and type of the attributes should be identical. i.e

-Source: -Target:

--Name (String) --Name (String)

--Number (integer) --Number (integer)

Else it will not throw an error, but will not copy the values. Only matching fields will be copied.

copycorresponding can be used in a for loop to copy selected values

Regards,

Poojith MV

Answers (2)

Answers (2)

Former Member
0 Kudos

Can anyone suggest me, if i can achieve copying data from one recursive node to another for bringing in a buffer layer?

both the structures, along with the name are exactly same!

any light? I had tried copy services and itsnot working in the case of recursive nodes

Regards

Senon

Former Member
0 Kudos

Hi,

You can use the following code:


WDCopyService.copyElements(srcElement, targetElement);

However you can also copy the entire node with:


WDCopyService.copySubtree(srcNode, targetNode);

Regards,

Manoj