cancel
Showing results for 
Search instead for 
Did you mean: 

dynamically set cardinality

Former Member
0 Kudos

hi,

i hv created a table dynamically.

i want to add entries to it.

bt it takes only 1 entry .

if i write the 2nd one i get the error:

must not add elements to a Node of cardinality 0..1or 1..1

i hv written the following code:

IWDNodeInfo node=

wdContext.getNodeInfo().addChild(

"TableNode",null,true,true,false,false,false,true,

null,null,null);

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

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

IWDNode node1 = wdContext.wdGetAPI().getRootNode().getChildNode("TableNode",IWDNode.LEAD_SELECTION);

IWDNodeElement ne = node1.createElement();

ne.setAttributeValue("Name","Parama");

ne.setAttributeValue("Address","parama.laha@lntinfotech.com");

node1.addElement(ne);

how do i set the cardinality of node to 0:n,

so that i can enter multiple values into my table?

plz help.

thanx.

regards,

ankita

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Try this:


IWDNodeInfo node = wdContext.getNodeInfo().addChild("TableNode",
                                                     null,
                                                     true, //singleton
                                                     false, //mandatory, setting this to true sets the min. cardinality to 1
                                                     true, //multiple, setting this to true sets the max. cardinality to n 
                                                     false,
                                                     false,
                                                     true,
                                                     null,
                                                     null,
                                                     null
                                                   );
//Now the cardinality of the created value node is 0...n
// The rest of the code remains same...

Regards,

Satyajit.

Former Member
0 Kudos

hi Satyajit,

thanx.

regards,

ankita

Answers (0)