cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Context - DropDown

Former Member
0 Kudos

Hi experts,

I want to write a method who should add n-values to an attribute. Later the values should be shown in a dropDownList!

Context:

Node - Node_1

|------- Attribute: Attribute_1


method( IWDNode iwdNode ) {

IWDNodeElement iwdNode = iwdNode.createElement();
nodeElem.setAttributeValue( "Attribute_1",	new Object[] { "ValueTest" });
}

Error: ClassCastException

Can someone pls help?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Do it like this:


// NODE[Card: 1..n, Sele:1..1]  If its mandatory
// NODE[Card: 0..n, Sele:0..1]  If its not mandatory 
for (int i = 1; i <= 101; i++)
{
	IPrivate<UrViewname>Nodes.I<NodeName>Element <NodeName>Element = wdContext.create<NodeName>Element();
	<NodeName>Element.set<AttributeName>("Value Number "+ i);
	wdContext.node<NodeName>().addElement(<NodeName>Element);
}

Regards

Julio Herrera

Former Member
0 Kudos

Thanks for your answer,...

But I can't say the the attributes <UrViewname>Nodes, .I<NodeName>Element ... because they should set dynamic.

The Method know only the value for the DropDownList and NodeName...

So it is possible to do this with this information or need I more information?

Former Member
0 Kudos

Darn It xD... probably it will work anyways /gg


// NODE[Card: 1..n, Sele:1..1]  If its mandatory
// NODE[Card: 0..n, Sele:0..1]  If its not mandatory 

public void AddValueToDDL( java.lang.String nodeName, java.lang.String attributeName, java.lang.String value )
  {
    //@@begin AddValueToDDL()
	IWDNode node = wdContext;

	node = node.getChildNode(nodeName, IWDNode.LEAD_SELECTION);
	IWDNodeElement newElement= node.createElement();
	newElement.setAttributeValue(attributeName, value);
	node.addElement(newElement);
    //@@end
  }

And Call that method:

AddValueToDDL("Nodo","AttrName", "Value1");
AddValueToDDL("Nodo","AttrName", "Value2");
AddValueToDDL("Nodo","AttrName", "Value3");

Regards

Julio Herrera

Answers (1)

Answers (1)

Former Member
0 Kudos

Is it a DropdownbyKey or DropdownByIndex?

Former Member
0 Kudos

DropDownByIndex