cancel
Showing results for 
Search instead for 
Did you mean: 

How to set the cardinality property as 1..n for a dynamically created node

Former Member
0 Kudos

Hi...everybody

I am creating Dropdown by index UI element and the

context atrributes dynamically.To bind multiple data to a dropdown

the cardinality property of the node should be 0..n or 1..n,

But i could not set the property of the dynamically created context node to 0..n ...

can any body suggest me..

I implemented the following code in WDDoModify View

IWDTransparentContainer tc=(IWDTransparentContainer)view.getElement("RootUIElementContainer");

IWDNodeInfo node = wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,

null,null);

IWDAttributeInfo strinfo=node.addAttribute("Value","ddic:com.sap.dictionary.string");

dbyindex.bindTexts(strinfo);

tc.addChild(dbyindex);

I could successfully display one value in the drop down,by adding the following code before the line tc.addchild(dbyindex);

IWDNode node1=wdContext.getChildNode("DynamicNode",0);

IWDNodeElement nodeElement=node1.createElement();

nodeElement.setAttributeValue("Value","Hello");

node1.addElement(nodeElement);

but when

i am trying to bind multiple values i am getting Exception ,,,,

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

hi

you are getting the exception because of cardinality property.

i.e true,false and

you are trying to add morethan one element.

so,if you want to add morethan one than one element you have to set the cardinality property to true,true (or) false,true.

In your code do the following modification for changing the cardinality.

For 0..n -->false,true

1..n-->true,true

IWDTransparentContainer tc=(IWDTransparentContainer)view.getElement("RootUIElementContainer");

IWDNodeInfo node = wdContext.getNodeInfo().addChild("DynamicNode",null,true,true,false,false,false,true,null,

null,null);

IWDAttributeInfo strinfo=node.addAttribute("Value","ddic:com.sap.dictionary.string");

dbyindex.bindTexts(strinfo);

tc.addChild(dbyindex);

hope this will solve your problem.

In addchild(..) the parameters are

addChild("Name ,

Element class for model node ,

Is singleton? ,

Cardinality ,

Selection cardinality ,

Initialise lead selection? ,

Datatype ,

Supplier function ,

Disposer function);

Regards

sowmya

Former Member
0 Kudos

Thanks Sowmya ,

Thank you for your solution .....

I could solve my problem.

Regards

Madhavi

Edited by: madhavi kotra on Aug 22, 2008 11:04 AM

Edited by: madhavi kotra on Aug 22, 2008 12:33 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Make use of the following method

IWDNodeInfo addChild(String name,

Class elementClass,

boolean singleton,

CMICardinality collection,

CMICardinality selection,

boolean initializeLeadSelection,

IStructure structure);

Ex:

IWDNodeInfo node = wdContext.getNodeInfo().addChild("DynamicNode", null, true, CMICardinality.ONE_TO_MANY, CMICardinality.ONE, true, null);

Regards

Ayyapparaj