cancel
Showing results for 
Search instead for 
Did you mean: 

Table with DropDownBox with data from child node

Former Member
0 Kudos

Hi,

I have following context:

Node Parent (0..n)

-- Node Child (0..n)

-


Child Attribute 1

-


Child Attribute 2

-- Parent Attribute 1

-- Parent Attribute 2

The parent node has a child node with cardinality 0..n. Now I created a table from the Parent node with several columns. In one column is a

DropDownBox that should display the data of the Child node, depending on the Parent node element.

-


Parent | Parent DropDownBox |

-


Parent 1 | Parent 1 Child Attribute 1 |

Parent 1 Child Attribute 2

-


Parent 2 | Parent 2 Child Attribute 1 |

Parent 2 Child Attribute 2

-


How can I fill the child node with data depending on the parent node element? How is the mapping between both?

IParentElement parentElement;

IChildElement childElement;

while (rs.next()) {

parentElement = wdContext.createParentElement();

parentElement.setAttribute1(rs.getLong("ID"));

parentElement.setAttribute2(rs.getString("SYSTEM"));

wdContext.nodeParent().addElement(parentElement);

while (rs2.next()){

childElement = wdContext.createChildElement();

childElement.setAttribute1(rs2.getLong("ID"));

childElement.setAttribute2(rs2.getString("NAME"));

wdContext.nodeChild().addElement(childElement);

}

}

If the child node is non-singleton I have the following option

parentElement.nodeChild.addElement(childElement);

But this doesn't work for singleton nodes. How can I do something similar for singleton nodes?

Thanks for your help,

Andi

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

If you want a separate child node for each parent element, make the child node non-singleton.

Armin

Answers (2)

Answers (2)

Former Member
0 Kudos

Perfect. As you guys said, I changed the child node to non-singleton and now it works fine.

Thanks Armin for the explanation.

Andi

Former Member
0 Kudos

Hi,

For singleton nodes, only one instance will be available. So u cant add more than one element to a singleton node. So do as Armin suggested

Regards

Fahad Hamsa

Former Member
0 Kudos

Not quite correct.

You can add more than one <b>element</b> to a singleton node (if cardinality is *:N).

But a singleton child node exists only once per parent <b>node </b>and not once per parent <b>element</b>.

That's an important difference.

Armin