cancel
Showing results for 
Search instead for 
Did you mean: 

WDCopyService - copy model node to Value node

Former Member
0 Kudos

Hi all,

I have a Model Node Structure

Bapi_Project_GetInfo (Model node)

|

-->Output_Project_GetInfo (Model node)

--->E_Activity_Table_Project_GetInfo (Model node)

|

-


> Network (Model Attribute)

-


> Short text (Model Attribute)

My Value node Structure

Project_GetInfo (Value node)

|

-->Output_Project_GetInfo_VN (Value node)

--->E_Activity_Table_Project_GetInfo_VN (Value node)

|

-


> Network (Value Attribute)

-


> Short Text (Value Attribute)

I want to copy the model attribute to Value attribute.

See my code below..

IWDNodeElement elemSrc, elemDest;

int sizeAccAss = wdContext.nodeE_Activity_Table_Project_GetInfo().size();

for (int i = 0; i < sizeAccAss; i++) {

wdContext

.nodeE_Activity_Table_Project_GetInfo().setLeadSelection(i);

elemSrc = wdContext.currentE_Activity_Table_Project_GetInfoElement();

elemDest = wdContext.createE_Activity_Table_Project_GetInfo_VNElement();

wdContext.nodeE_Activity_Table_Project_GetInfo_VN().addElement(elemDest);

WDCopyService.copyCorresponding(elemSrc, elemDest);

}

This is giving the exception as

Node(NetworkSchedulingDAMR3Comp.Project_GetInfo.Output_Project_GetInfo_VN.E_Activity_Table_Project_GetInfo_VN): cannot bind or add elements because the node has no valid parent

How to debug this..any sample code please.

Thankyou all,

Karthick.K.E

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Karthick,

Try the following code

for(int i=0 ; i<wdContext.E_Activity_Table_Project_GetInfo().size() ; i++){

wdContext.currentE_Activity_Table_Project_GetInfo_VNElement targetElem = wdContext.createcurrentE_Activity_Table_Project_GetInfo_VNElement();

wdContext.currentE_Activity_Table_Project_GetInfoElement srcElem = wdContext.nodeE_Activity_Table_Project_GetInfo().getE_Activity_Table_Project_GetInfoElementAt(i);

WDCopyService.copyCorresponding(srcElem,targetElem);

wdContext.nodenodeE_Activity_Table_Project_GetInfo_VN().addElement(targetElem);

}

Regards

Prakash

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Karthick,

When you are copying data to destination. destination object should be created. But, here, You have not cretae object for Project_GetInfo. So, first create object of this node using,

wdcontext.createProject_GetInfoElement() method and then bind this ele to the "Project_GetInfo" node using,

wdcontext.nodeProject_GetInfo().bind(<element>);

Now, you need to do same thing for node "E_Activity_Table_Project_GetInfo_VN".

Here, instead of bind method use AddElement() method, because you need to add multiple elements for this.

Then your code will work fine.

Regards,

Bhavik

Former Member
0 Kudos

Hi ,

My Server is down.I 'll try your suggestions once the server is in running state.

Regards,

Karthick