cancel
Showing results for 
Search instead for 
Did you mean: 

adding into Component Contollers Context,

Former Member
0 Kudos

Hello !

Following situation is given.

I want to add all these Order into Component Contollers Context, but how ?

They are mutiple Orders

Order[] arrq = wdThis.wdGetOrdersModelInterface().orderGetCached();

Please notice state also this informatiom Type and cardinality !

Name of Context Node : SalesOrder cardinality ????

Name of Context Attribute : salor Type???

Thanks

Sas Erdem

Accepted Solutions (1)

Accepted Solutions (1)

sridhar_k2
Active Contributor
0 Kudos

Sas,

Order[] arrq = wdThis.wdGetOrdersModelInterface().orderGetCached();

Create context variable SalesOrder, Change Type to Java Native Type -> ArrayList or any other util object.

Set Value to the variable like this.

wdThis.wdGetOrdersModelInterface().wdGetContext().currentContextElement().setSalesOrder(arrq );

Get Object like this.

if(wdThis.wdGetOrdersModelInterface().wdGetContext().currentContextElement().getSalesOrder()){

Order[] arrq1 = (Order[]) wdThis.wdGetOrdersModelInterface().wdGetContext().currentContextElement().getSalesOrder();

}

Hope it is clear to you, write me back if you need any thing more.

Regards,

Sridhar

Answers (2)

Answers (2)

Former Member
0 Kudos

Ayyapparaj Thank you!

How can I contact to you ?

Regards

sas

Former Member
0 Kudos

Hi,

They are mutiple Orders

Order[] arrq = wdThis.wdGetOrdersModelInterface().orderGetCached();

As you want to add the orders returned

Create a context node lets say "Orders" cardinality 0..n

and create the attributes as they exists in your Oder bean. Ex as you mentioned salesordertype

then iterate through this Order array and populate the orders node created in previous step.


for(int x=0;x<arrq.length; x++)
	  {
		 IOrdersElement ordersElement = wdContext.nodeOrders().createAndAddOrdersElement();
		 ordersElement.setOrderType(arrq.getOrderType); //Guess that your OrderType returns from your bean
	  }

Regards

Ayyapparaj