Conditionals in calculations

I’m using Gravity Forms to create a pricing calculator. This is easy with calculations, however the calculation is too simple without conditionals.

I’m my case, the price varies depending on how many employees the customer has:

0-10 employees - 15$ / employee
10-50 employees - 10$ / employee
+50 - Request offer

My problem is, that I can’t calculate with either 10$ or 15$ depending on how many employees the customer entered in the employee numbers field.

Right now I have to solve this in a very hacky way. I have to add multiple calculation fields that are either shown or hidden depending on how many employees the customer entered in the employee numbers field. This is a mess in the form builder and especially in the notification email.

With calculation conditionals this could be solved, and it could open up opportunities for way more advanced calculations.

2 Likes

My vote for this one, not only for If statements, but for using also text strings/text fields within the calculations.

2 Likes

Hi Jeppe,

I’m a PHP dev who has done projects somewhat close to your own, of which I am releasing some of the code I wrote for that to the OpenSource community. I think some of what it can do could be helpful to part of your requirements. Specifically the capturing of the user’s input for easy access in other forms and backend custom code.

I just put online a very simple demo (and documentation) of an example of data from one form being used by another, all working with no custom code other than the new “MFSFS” plugin now in beta testing. You are welcome to check out the demo (the documentation for it is at the repo on GitHub if it interests you) - see links below.

It does sound like you could greatly simplify and solve your needs with a little backend coding help. It sounds like you need some custom data handling logic to process your inputs and a little bit of output formatting. If you decide to enlist some coding assistance feel free to drop me a DM.

Cheers and good luck !
-JAS

Ref: “shared forms demo 3”

https://wp.www-net.com/awn-wp-dev-homepage/gf-mfsfs-multi-form-demo-3-clothing-shopper-profile/

Related documentation: