on 06-26-2005 4:55 PM
Hello All,
I keep getting the above error message. Can someone help ?
<u><b>Context Structure</b></u>
- A (Model Node)
- B (Sub Model Node of A)
++ Country (Model Attribute B)
++ Language(Model Attribute B)
<u><b>Coding</b></u>
IPrivateMainView.IAElement userInfo = wdContext.createAElement(new A());
wdContext.nodeB().addElement(userInfo);
The error stack always report that the above syntax causes the error message.
Can someone kindly let me know where I may have gone wrong ? Thank you.
from
Kwok Wei
It seems that you create element A but not add it to node A. You may add children (i.e. elements of B) only when all parents are bound. So the code should looks like:
IPrivateMainView.IAElement userInfo = wdContext.createAElement(new A());
/* Add parent first */
wdContext.nodeA().addElement(userInfo);
/* Next manipulate with child */
wdContext.nodeB().addElement(elementB);
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey, this was it! at least my problem is solved!
I had kind of the same structure and solved it by adding a root <i>element</i> to a root <i>node</i>:
wdContext.nodeDB_AllData().addElement(allData);
wdContext.nodeDB_AllData().nodeHeader().addElement(header);
wdContext.nodeDB_AllData().nodePositions().addElement(positions);
hi,
To my understanding i think a is the parent of b .. I am wondering how u can add the parent to the child..
"cannot bind or add elements because the node has no valid parent"
means the nodeB s parent element is not created or no parent is specified...
so you have to create the parent element and then use the parent object to create the child node...
IPrivateMainView.IAElement userInfo = wdContext.createAElement(new A());
userinfo.nodeB().addElement(node B object );
Regards
Bharathwaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bharathwaj ,
The singleton property is already set to true. In fact when i try to change the supplyFunction property, a window pops up saying "A supplying relation role is already defined for this contex node. etc ......"
A wild shot here but will the cardinality make any difference ? its 0..1 for both A and B.
from
Kwok Wei
Hi,
The model node is a reference to the model object so you need to bind the node to a similar structure or table from the model object.
eg.
abc(model node)
|__def(model subnode)
|___attr_a
|___attr_b
Then you need to first bind abc node
abc ele=new abc();
wdContext.nodeAbc().bind(ele);
Then bind the def to the corresponding def node
def subele=new def();
ele.setDef(subele); or ele.addDef(subele);
Regards
Noufal
Message was edited by: Noufal Kareem
Message was edited by: Noufal Kareem
User | Count |
---|---|
78 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.