cancel
Showing results for 
Search instead for 
Did you mean: 

assigning values to a value attribute

Former Member
0 Kudos

Hi, Am getting List of values in Arraylist from one application,

How to assign this values to a value attribute under one particular node.

Regards,

Venki

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

If your node is "A" and elemente "ele1" and "ele2" as elements under it

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

IAElement ele=wdContext.nodeA().createAElement();

ele.setEle1("value from list");

ele.setEle2("value from list");

wdContext.nodeA().addElement(ele);

}

Edited by: Sudhir Gorantla on Aug 6, 2008 4:10 PM

PradeepBondla
Active Contributor
0 Kudos

Hi,

if your node is "a" and attribute under it is "v" and your view is xyz view

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

{

IPrivateXYZ.IAElement aele =wdContext.nodeA().createAElement();

aele.setV(""+arraylist.get(1));

wdContext.nodeA().addElement(aele);

wdComponentAPI.getMessageManager().reportSuccess(wdContext.currentAElement().getV());

}

PradeeP

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Following is a sample code to acheive this,



ArrayList arr; //Array list that you get from some application
	  
	  //Node->Orders
	  //   Attr1->OrderId
	  //   Attr2->Qty
	  
	  for(int x=0; x< arr.size(); x++)
	  {
		  IWDNodeElement nodeElement = wdContext.nodeOrders().createElement();
		  //Assuming this arraylist contains objects of type Order
		  Order ord = arr.get(x);
		  nodeElement.setAttributeValue("OrderId", ord.getId());
		  nodeElement.setAttributeValue("Qty", ord.getQty());
		  wdContext.nodeOrders().addElement(nodeElement);
		  
	  }

Regards

Ayyapparaj

Former Member
0 Kudos

I am doin the same but in dropdown it is displaying only one country insted of all.