on 10-08-2006 1:12 PM
Hi Forum,
I have a problem with my ViewContext and the Nodes.
I have the following context:
RootContext->Products(1:n)[value node]->County(1:1)[value node]->C_BEZ(value attibute)
First I am doing a loop over my Products and setting a Date, then I want so set the value in the subnode "Country". Now the problem: How can a access the subnode "Country" from each "Product" row.
int n = wdContext.nodeProducts().size();
Date d = wdContext.currentContextElement().getDate();
for (int i = n - 1; i >= 0; --i) {
IWDNodeElement element = wdContext.nodeProducts().getElementAt(i);
// This works!!!!
element.setAttributeValue("DATE", d);
// Only in the first Product the County gets set
Iterator iter = wdContext.nodeProducts().getElementAt(i).node().getNodeInfo().iterateChildren();
int c = 0;
while (iter.hasNext()) {
IWDNodeInfo nodeInfo = (IWDNodeInfo) iter.next();
IWDNode currentNode = wdContext.nodeProducts().getChildNode(nodeInfo.getName(), IWDNode.LEAD_SELECTION);
currentNode.getElementAt(c).setAttributeValue("C_BEZ", "TEXT");
c++;
}
Chris,
Make node Country non-singleton (set singleton=false in context designer), then access it like:
IPrivate<ControllerName>.IProductsElement product
= wdContext.nodeProducts().getProductsElementAt(i);
IPrivate<ControllerName>.IContryNode countries
= product.nodeCountry();
Valery Silaev
SaM Solutions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.