cancel
Showing results for 
Search instead for 
Did you mean: 

Updating Child Nodes

former_member82844
Participant
0 Kudos

I am trying to update the attribute on a child node and cannot get past the first record.

Context:

ParentNode 0-N

-- ChildNode 1-1

-- ChildAttribute1

-- ParentAttribute1

-- ParentAttribute2

I need to loop through all Parent Nodes and update the ChhildAttribute1 with the value from ParentAttribute2

ParentNodeNode thisNode = Context.nodeParentNode();
int elementCount = thisNode.size();
for (int i = 0; i < elementCount; i) {
   setLeadSelection(i);
   thisNode.nodeChildNodeNode().currentChildNodeElement().setChildAttribute1(thisNode.getElementAt(i).getAttributeValue("ParentAttribute1"));
}

This does not work. It does not give me an error but does not populate the val;ues either...

Help .

Accepted Solutions (0)

Answers (2)

Answers (2)

vmadhuvarshi_
Contributor
0 Kudos

Glenn,

Where are you populating your parent node? Since cardinality of your parent node is 0-N, there will be no default element assigned.

In your loop, value of elementCount will be 0, so there is no error but no results either.

You may want to take a look at [this tutorial|/docs/DOC-8061#63].

Hope this helps.

former_member191569
Active Participant
0 Kudos

Has your child node singleton = true? Every time the lead selection in a parent node changes, all singleton child nodes must be rebuilt. You can try with a supply function