Hello--
I have a form with with a dynamic subform that the user can add lines to with a button.
Within each line of the repeating subform is a dropdown named category and a numeric box named hours.
Throughout the day the user will add a line for each task they perform, select the category and input total hours.
I would like to create a total hours by category in the footer to sum up all the hours for each category that day.
If I was doing this with SQL I would go with (Select SUM(hours) where category=X)
I would like one total hours numeric box for each category.
Is this possible in javascript or formcalc?
Thanks.....
Views
Replies
Total Likes
Hi,
You can do that using a table.You can add records or delete records using the Buttons.
Based on the category "A" the total is calculated. Below is the script you can refer for the final total of Category "A".
Below script is on the Calculate event of the Total 3 field and Language is JavaScript.
this.rawValue = total1.rawValue + total2.rawValue
Below script is on Calculate Event of the final Total field and Language is JavaScript.
// Getting the count of number of rows repeated
var numberOfRows = form1.Page1.AddorRemove.Row2.instanceManager.count;
//final total initialization
var total = 0;
for (var i=0; i<numberOfRows; i++){
// checking category is selected or not
if( xfa.resolveNode("form1.Page1.AddorRemove.Row2["+i+"].Category") != null && xfa.resolveNode("form1.Page1.AddorRemove.Row2["+i+"].Category").rawValue != null ){
// getting the category values
var categoryValue = xfa.resolveNode("form1.Page1.AddorRemove.Row2["+i+"].Category").rawValue;
// Matching the category values with "A"
if (categoryValue == "A"){
// Summing the total based on the "A" Category
total += xfa.resolveNode("form1.Page1.AddorRemove.Row2[" + i + "].Total3").rawValue;
}
}
}
I hope this script would give you idea. if you cant understand let me know or mail me you form to muchukotavijay@gmail.com.
Vjay
Views
Replies
Total Likes
Hello,
Great solution. I used and worked perfect. Found other places to utilize as well....
Thanks
Views
Replies
Total Likes