Can Formulas in a Subform work with Controls from OTHER Subforms?

Comments

8 comments

  • Avatar
    Nik

    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)

  • Avatar
    Valerie Westres

    this is not for nested subforms; it is for 2 subforms within the same form, where i am using the exact same formula.

    thanks,

  • Avatar
    Karl Makatenas

    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:[*]})

  • Avatar
    Valerie Westres

    thanks but no luck : /

  • Avatar
    Karl Makatenas

    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 built-in pretty-printer, 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)) {

  • Avatar
    Valerie Westres

    cool, but not sure what's next... i don't understand what to do, if any, with the piece of code provided :o)

  • Avatar
    Karl Makatenas

    The only options would be to pull the formulas out of the limited-scope subforms and place them somewhere that the scope lets them see the fields they're calculating, or to build a from-scratch custom JavaScript solution.

    (Or submit a bug report to AgilePoint and see if they want to handle the issue or give you a workaround.)

  • Avatar
    Valerie Westres

    perfect. i'll try moving them to where the scope works. great idea! thanks,

Please sign in to leave a comment.