I am looping through some replicant containers and setting the label of the container based on the value of a text item in the container. I have the following code:
function sortingCallout() {
var lvl1_children = IWDatacapture.getItem("/node_attributes/lvl_1").getChildren();
var lvl1_num_children = lvl1_children.length;
for (i=1; i<=lvl1_num_children; i++){
var lvl1 = IWDatacapture.getItem("/node_attributes/lvl_1[" + i + "]");
var lvl1_label = IWDatacapture.getItem("/node_attributes/lvl_1[" + i + "]/path").getValue();
lvl1.setLabel(lvl1_label);
lvl2_children = IWDatacapture.getItem("/node_attributes/lvl_1[" + i + "]/lvl_2").getChildren();
lvl2_num_children = lvl2_children.length;
for (j=1; j<=lvl2_num_children; j++){
var lvl2 = IWDatacapture.getItem("/node_attributes/lvl_1[" + i + "]/lvl_2[" + j + "]");
var lvl2_label = IWDatacapture.getItem("/node_attributes/lvl_1[" + i + "]/lvl_2[" + j + "]/path").getValue();
lvl2.setLabel(lvl2_label);
}
}
}
What is happening: this function is being called from a callout button on my DCT. It loops into the first replicant - lvl_1 - fine. Sets the first label. Loops into the second level of replicants - lvl_2 - and sets the label on the first replicant.
And then it fails. I get a JS error in my browser complaining about something being null. If I throw in an alert after the
lvl2.setLabel(lvl2_label); line, I don't see the alert - ever. So it's executing that line of code and failing... On what? I actually see the label changed properly...
Any help always appreciated.
Thanks.
TS 7.2.1
Windows 2003