cancel
Showing results for 
Search instead for 
Did you mean: 

Copy data from the value node to the model node.

Former Member
0 Kudos

Hi all,

I have the context Structrue for a View as :

Value Node:

Context.

- TestNode(Patent Node)

-SampleNode(Child Node)

-Attribute

-Attribute

-StatusNode(Child Node)

-Attribute

-Attribute

Model Node :

Request_Update(Parent node)

-UpdateReqMsg(Child Node)

- Update(Child Node )

--Attributes

--Attributes

- UpdateStatusNode(ChildNode)

--Attributes

--Attributes .

In the view , the Ui elements are bound to the Value nodes .in the Action method of a Button , i want to copy the data to the model nodes and Excecute the Web Service.(So that the User Entered data is saved in the Database).

Please tell me how to copy the data from the value node to the model node, whether i can use the copy service method for copying the data or any other suggestions.

Thanks and Regards

fazal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi ,

ArrayList Arr = new ArrayList();

IPrivate<View>.I<valueElement> ele=null;

wdContext.node<model>().moveFirst();

for(int i=0;i<wdContext.node<model>.size();i++)

{

String var1= wdContext.current<model>Element().getvar1();

String var2= wdContext.current<model>Element().getvar2();

ele2 = wdContext.create<value>Element();

ele2.setvar1(var1);

ele2.setvar2(var2);

Arr.add(ele);

wdContext.node<model>().moveNext();

}

wdContext.node<valuenode>().bind(Arr);

Regards,

Sunitha Hari

Answers (3)

Answers (3)

former_member201361
Active Contributor
0 Kudos

Thanks all For ur Valuable Comments.

Thanks and Regards

Fazal Ahamed B

Former Member
0 Kudos

Hi ,

Jhansi Miryala is right . pl create one dummy object or element of target node before copying.

If problem solved then award the points and close the thread.

thanks & Regards

Manoj Sahoo

Former Member
0 Kudos

If you have created the model of webservice using adaptive webservice model, you can use code similar to the one below

SampleModel model = new SampleModel();

// node where inout should be set - say details node

Details input = new Details(model);

//setting input

input.setType(transactionType);

input.setInvoiceNo(String.valueOf(invoiceNo));

input.setEquipmentCode(equipmentCode);

//Creating request object

Request_Details requestObj = new Request_Details(model);

setting the node for input to request object

requestObj.setDetails(input);

//binding request object to original node

wdContext.nodeRequest_Details().bind(requestObj);

// executing model

wdContext.currentRequest_DetailsElement().modelObject().execute();

// invalidating to refresh the data and records acan be fethced from this.

wdContext.nodeResponse_Details().invalidate();

Please note the name of model node and the request and response sub node name. You have to set the input in request node and bind it and execute the same. the structure and name will be different for you.

Hope it helps

former_member201361
Active Contributor
0 Kudos

Hi,

Thanks for the reply.

But my problem is not with the executing web services .

just want to know , how to copy the data from the value node to the model node.

Thanks and Regards

fazal

Former Member
0 Kudos

Hi Fazal Ahamed ,

In general WDCopyService is used when you want to copy the values from Model node to Value Node not vice versa. ie., When you are copying data to destination, destination object should be created.

The method WDCopyService.copyElements copies only those attributes from "source" which are present in "target" and if they match (the names equal case-sensitive and the types are compatible).

and your contexts nodes have the same sets of attributes.

In your case you can use the normal code to send the values to back end.

Regards,

Jhansi Miryala