I have a table with a drop down list with two values: '$' and 'Hr' (cell called 'PType'). There is a cell called 'Proposed' that contains numerical data. The table is dynamic and can have more cells inserted via a button within the row. I have a totals section that I want to total the SUM of 'Proposed' if the value in 'PType' is '$'. I can't figure out what type of statement will allow me to write this.
For now, my solution has been a hidden column whose cell simply states:
if (PType == "$") then
Proposed
endif
Then, in the totals section, I sum this hidden column since a value outside of '$' returns a '0' and won't affect my SUM.
I am looking for a formula I can write that does this within the totals cell instead of having two cells.
Thanks,
Mallard27
Solved! Go to Solution.
Views
Replies
Total Likes
Here's my take on it.
// form1.page1.subform1.table.footer.SUM::calculate - (JavaScript, client)
var total = 0;
for (i=0; i < form1.page1.subform1.table._row.count; i++) {
if (table.resolveNode("row[" + i + "].Proposed").rawValue) {
if (table.resolveNode("row[" + i + "].PType").rawValue == "$") {
total = total + parseFloat(table.resolveNode("row[" + i + "].Proposed").rawValue);
}
}
}
this.rawValue = parseFloat(total);
Steve
Views
Replies
Total Likes
Here's my take on it.
// form1.page1.subform1.table.footer.SUM::calculate - (JavaScript, client)
var total = 0;
for (i=0; i < form1.page1.subform1.table._row.count; i++) {
if (table.resolveNode("row[" + i + "].Proposed").rawValue) {
if (table.resolveNode("row[" + i + "].PType").rawValue == "$") {
total = total + parseFloat(table.resolveNode("row[" + i + "].Proposed").rawValue);
}
}
}
this.rawValue = parseFloat(total);
Steve
Views
Replies
Total Likes
Thanks Steve!!!!
That did the trick.
Views
Replies
Total Likes
Is it possible to have a pre-made table already? I tried the code you provided however in my case, I do not have the "add row" button. I already have a table with 20 rows with an amount column and a dropdown column.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies