Hello experts,
I am new to Adobe forms and i have been struggling to calculate the total of a column based on condition.
My problem is that when i try the code below i cannot access any property of oFields(e.g. length, item...). I tried different combinations but nothing seems to work:
Here is how the Hierarchy looks like:
Can you please give any suggestion?
Thank you!
Solved! Go to Solution.
Views
Replies
Total Likes
Assumptions:
1. You want to look at the value of a specific field in each of the repeating table rows to determine if it has a value. If it does, then add that value to the total variable.
2. That rowHUDataTBL is a repeating row in the table.
I would use the following:
var total = 0;
var rowCount = frmHUTable.tblHandlingUnits.rowHUDataTBL.instanceManager.count;
for (i=0; i<=rowCount; i++)
{
var rowNode = frmHUTable.tblHandlingUnits.resolveNode("rowHUDataTBL[" + i + "]").Name of the field you want to check for value.rawValue; Example: colGrossVolume.rawValue;
if (rowNode != null)
{
total = total + rowNode;
}
}
You may need to input the full path to the repeating table row starting from the top: xfa.form.root node name. ... all the way down to the rowHUDataTBL.
Also use app.alert() or console.println() to debug and show the variable values. You will have to look up the syntax and how to get the Javascript debugger to be active in Designer for the console.println().
You can write like below:
var total =0;
Hi Vijay,
Thank you for you reply.
The issue is that after i define var oFields i cannot use any of the property of this object after i type oFields.
I tried with lenght, item but it does not work.
Any suggestions?
Just to add that the following syntax is working:
var len = xfa.resolveNodes("tblHandlingUnits.rowHUDataTBL[*]").length;
but doesnt work if i try it like:
var len = xfa.resolveNodes("tblHandlingUnits.rowHUDataTBL[*]");
var temp = len.length;
what is not working here, seems valid code. try to print to check if it shows the length value.
app.alert(temp);
Assumptions:
1. You want to look at the value of a specific field in each of the repeating table rows to determine if it has a value. If it does, then add that value to the total variable.
2. That rowHUDataTBL is a repeating row in the table.
I would use the following:
var total = 0;
var rowCount = frmHUTable.tblHandlingUnits.rowHUDataTBL.instanceManager.count;
for (i=0; i<=rowCount; i++)
{
var rowNode = frmHUTable.tblHandlingUnits.resolveNode("rowHUDataTBL[" + i + "]").Name of the field you want to check for value.rawValue; Example: colGrossVolume.rawValue;
if (rowNode != null)
{
total = total + rowNode;
}
}
You may need to input the full path to the repeating table row starting from the top: xfa.form.root node name. ... all the way down to the rowHUDataTBL.
Also use app.alert() or console.println() to debug and show the variable values. You will have to look up the syntax and how to get the Javascript debugger to be active in Designer for the console.println().
@TsvetelinGe Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.
Views
Replies
Total Likes