Expand my Community achievements bar.

insert a value in a table with a multiple instanced row in a multiple intanced subform

Avatar

Level 2

First a little background on my problem.

A part of my form is designed to show how the lamp units for our produkt should be built.

There could be 0 to 4 lamp units on the product and each lamp unit can have 2 to 6 lamps.

So when they fill in the amount of lamps I create that same amount of instances of the subform "LampUnits" and another table where they can fill in the amount of lamps per unit.

As soon as they fill in the qty for a lamp unit that qty(instances) of rows for that specific lamp unit is made. See picture.

signal lamps.png

this is how far I have managed to get.

but what I need to do now is to fill the id fields of the lamp units.

at this moment I have the following script behind the exit event of the lamp unit quantity cell:


DataSheet.TechnicalInformation.Lamps.QtyUnitsDiffer.TQtyLamps.rQtyLamps.nfQty::exit - (JavaScript, client)


var qtyinstance = xfa.form.DataSheet.TechnicalInformation.Lamps.QtyUnitsDiffer.TQtyLamps.rQtyLamps.resolveNode("xfa.form.DataSheet.TechnicalInformation.Lamps.QtyUnitsDiffer.TQtyLamps.rQtyLamps["+ this.parent.index +"]").nfQty.formattedValue;



xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits.LampTable.resolveNode("xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits.LampTable["+ this.parent.index +"]").TQtyLamps._rQtyLamps.setInstances(xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits.LampTable.resolveNode("xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits.LampTable["+ this.parent.index +"]").TQtyLamps._rQtyLamps.occur.initial);


xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits.LampTable.resolveNode("xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits.LampTable["+ this.parent.index +"]").TQtyLamps._rQtyLamps.setInstances(qtyinstance);



   var t=1;


    for (var i=0; i < qtyinstance  ; i++)


        {


        // var node1 = "xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits["+this.parent.index+"]"


        // var node2 = "xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits["+this.parent.index+"].LampTable.TQtyLamps.rQtyLamps[" + i +"]"


        xfa.form.DataSheet.TechnicalInformation.Lamps.LampUnits[nfQty.index].LampTable.TQtyLamps.rQtyLamps[i].tfId.rawValue= "lamp" + t;


       t++;


        }


*/


And now i'm stuck on line 12 of the script. how do I get the correct values in the correct cell in the correct subform?

does anyone have any suggestions?

b.r.

Simone

1 Reply

Avatar

Level 7

In the example you posted, should the lamps be named lamp1 - lamp9? or are you looking for something a little more specific for each lamp?

Best I could make up without having more knowledge of what you want here:

the first box for quantity (which I'm calling nfLampUnits) gets this exit event:


sfLocations.tbLocations.Row1.instanceManager.setInstances(this.rawValue); //set the number of rows in the first table


sfQuantity.tblQuantities.Row1.instanceManager.setInstances(this.rawValue); //set the number of rows in the second table


for (i=0; i<this.rawValue; i++){


    xfa.resolveNode("sfLocations.tblLocations.Row1["+i+"].tfLampUnit.value.#text").value = "Lamp unit "+parseInt(i+1);


    xfa.resolveNode("sfQuantity.tblQuantities.Row1["+i+"].tfLampUnit.value.#text").value = "Lamp unit "+parseInt(i+1);


}


sfOverview.instanceManager.setInstances(this.rawValue);


Then, in the Quantity table, the box for quantity (nfQuantity) gets this exit event:


xfa.resolveNode("sfOverview["+this.parent.index+"].tblOverview.Row1").instanceManager.setInstances(this.rawValue); //set the number of rows for the nth table wrapped in a subform


for (i=0; i<this.rawValue; i++){


    xfa.resolveNode("sfOverview["+this.parent.index+"].tblOverview.Row1["+i+"].tfLampUnit.value.#text").value =


        xfa.resolveNode("sfLocations.tblLocations.Row1["+this.parent.index+"].ddlocation").rawValue+" "+parseInt(i+1); //name the rows by their location and then an index


}


Of course, your field names appear to be different, but maybe this will at least serve as a guide.

testTableColumnFill.png