cancel
Showing results for 
Search instead for 
Did you mean: 

How can I copy the elements from one node to another node?

Former Member
0 Kudos

Hi All,

I would like to copy the elements from my Flight_List node to the OVSAirportQueryOutput node and map them after that, how can I do that? They have totally different elements.

I'm working on the OVSAirportContextNotificationListener and try to put the code into the onQuery(IWDNodeElement, IWDNode). Please tell me how to do this, and I would greatly appreciate that.

Regards,

-Napadol

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Use this code in wdDoInit();

{

IWDNode srcNode = (IWDNode)wdThis.wdGetFlightCompController().wdGetContext().nodeFlight_List();

IWDNode destNode = (IWDNode)wdContext.nodeFlight_Sorted();

WDCopyService.copySubtree(srcNode,destNode);

}

Answers (3)

Answers (3)

Former Member
0 Kudos

Thank you all for your responses and sorry for the late response. I did try all of your solutions, but since I am still new to the web dynpro it gave me all the errors such as "Invalid expression as statement." I have never use the IWDCopyService before, so I don't know where to place the codes in.

Actually, I am working on the Object Value Selector (OVS), but my task is to add another advance search for the airport. I added the airport name, airport city, and country in the view layout, and I also added OVSAirportContextNotificationListener in the OVSCust (Customer Controller). When I deploy and run the app., it gives me the airport advance search table to fillout the airport code. But when I clink on Go button after putting "JFK" or anything for the airport code, it shows me a blank hit list. I don't know where are all the information. Any suggestions?

Regards,

-Napadol

Former Member
0 Kudos

Hello,

If source node elements and destinationnode elements are same then WDCopyService will work

WDCopyService.copyElements(sourceNode,targetNode);

Otherwise you have copy manually from src to destination using for loop.

for(int i=0;i<Flight_List.size();i++)

{

// set the OVSAirportQueryOutput node elements

}

-SS

former_member187990
Participant
0 Kudos

Hi Napadol,

Try this Code

<b>IPrivate<View>.I<SourceNode>Node sourceNode=wdContext.node<SourceNode>();

IPrivate<View>.I<TargetNode>Node targetNode=wdContext.node<TargetNode>();

WDCopyService.copyElements(sourceNode,targetNode);</b>

Regards

Satish Kumar SV