on 02-14-2007 5:14 PM
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
If you want a separate child node for each parent element, make the child node non-singleton.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Perfect. As you guys said, I changed the child node to non-singleton and now it works fine.
Thanks Armin for the explanation.
Andi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.