Skip to main content
Nintex Community Menu Bar

use exponential functions in ui-only field to the power of

  • July 8, 2024
  • 6 replies
  • 26 views

Forum|alt.badge.img+11

I’d like to be able to use “to the power of” exponential functions in a UI-only field. Use case is estimating a payment amount on the front end of a public site. We have a formula field to do this, but the formula is blank until the record is saved, I’d like to show the calculation before saving. But it requires, in particular, this formula: “(1+ MonthlyInterest__c ) ^ NoofPayments2__c”, where the ^ symbol represents “to the power of”.

Would be great to see that as an option in the UI-only dropdown list of Operators.

In the mean time, any way to hack this?

This topic has been closed for replies.

6 replies

Forum|alt.badge.img+18

You could build a quick custom field renderer in javascript and use Math.pow().


Forum|alt.badge.img+13
  • Scholar
  • July 8, 2024
Jack_Sanford:

I’d like to be able to use “to the power of” exponential functions in a UI-only field. Use case is estimating a payment amount on the front end of a public site. We have a formula field to do this, but the formula is blank until the record is saved, I’d like to show the calculation before saving. But it requires, in particular, this formula: “(1+ MonthlyInterest__c ) ^ NoofPayments2__c”, where the ^ symbol represents “to the power of”.

Would be great to see that as an option in the UI-only dropdown list of Operators.

In the mean time, any way to hack this?

@jacksanford Hi, not sure if you ever succeeded in accomplishing this above. As i have now a very similar requirement and need to use EXP excel function. if you did and could share the way you did it, or JS you used (if any) that would be amazing!

Let me know

Thx


Forum|alt.badge.img+2

Hi @Dave, no I never did figure that out. Matt’s suggestion above is where I would start, create a snippet that fires whenever a given field is changed that updates the value using math.pow()


Forum|alt.badge.img+13
  • Scholar
  • July 8, 2024

Ok perfect thank you for quick answer 🙂


Forum|alt.badge.img+17

You can define a custom function and use that function in UI formula:

https://docs.skuid.com/latest/en/skuid/api/skuid_formula.html


Forum|alt.badge.img+1
  • July 8, 2024

expanding on @Skuidward_Tentacles idea. Custom formulas are great for user cases like this one. Create a new custom formula and paste this into there.

new skuid.formula.FormulaFunction (
  'powerOf',
  function (base, exponent) {
    return Math.pow(base, exponent);
    },
{
    namespace: 'test',
    numArgs : 2,
    returnType : 'number'
  }
);

To call this function in an UI-Only formula use:

test__powerOf((1+{{MonthlyInterest__c}}), {{NoofPayments2__c}})