I have tried a number of examples to make a button delete the LAST row of a table, but I cannot make it.
This is the script I am currently using, but it only delets the second row. I'm desperate, I don't know where's the mistake. Please help!
var sSubformSOM = "xfa.form.Summary.INTrack.INRecordTable.INRecord.Row1";
var bCalc = true;
var message = "You have reached the maximum number of items allowed.";
var oSubform = xfa.resolveNode(sSubformSOM);
var sParentSOM = oSubform.parent.somExpression;
var sManagerSOM = sParentSOM + "._" + oSubform.name;
var oManager = xfa.resolveNode(sManagerSOM);
var nMinCount = oManager.occur.min;
var nSubCount = oManager.count;
if (nSubCount > nMinCount) {
oManager.removeInstance(1);
if (bCalc == true) {
xfa.form.recalculate(1);
}
} else {
xfa.host.messageBox(message,"Remove Item", 3);
}