Can Formulas in a Subform work with Controls from OTHER Subforms?
I can't get a Formula in a Subform to Sum controls from another Subform. The formula does Validate correctly; however, it only works if I put the Formula in the main Form...

Is this for nested subforms or from the data within a line of the subform?
I believe that we needed to use a rule to trigger a formula field within a subform, because it is at the lower level it doesnt get triggered by field changes (this could be wrong or over simplification, I'll see if our dev can expound on it)

This is one thing I can never get right :(. Try some of the following formulas and see if any work. (Your original is listed first.)
sum(${InvoiceDetails1/AmountCurrency:[*]})
sum(${InvoiceDetails1/AmountCurrency:[this]})
sum(${InvoiceDetails1:[this]/AmountCurrency})
sum(${InvoiceDetails1:[this]/AmountCurrency:[*]})

Alright, I've spent a bunch of time on this and have some conclusions to make.
It seems that a formula is restricted to its own subform context. So a formula cannot look into the parent form for any data. However, if a formula is in a context that has a subform embedded within it, it can read everything in the subform. This perfectly aligns with your observations, so I'm quite confident in these findings.
Particularly, when I formatted the following file using Chrome's builtin prettyprinter, the line giving me all these ideas is line 6053. It seems that a copy of the data attribute is missing when a formula is applied from within a subform to the parent form.
https://devapp1.nxone.com/applicationbuilder/FormDesigner/bundles/eformrender.bundle.rendercore.js
if (void 0 === (t = "FormPanel" == n ? e.parents(".control:first").data(FbSubForm.options._previewCtrlWidgetKey).item.data("formulas") : i.item.data().formulas)) {

The only options would be to pull the formulas out of the limitedscope subforms and place them somewhere that the scope lets them see the fields they're calculating, or to build a fromscratch custom JavaScript solution.
(Or submit a bug report to AgilePoint and see if they want to handle the issue or give you a workaround.)
Please sign in to leave a comment.
Comments
8 comments