Nested calculations in GravityMath

GravityMath allows you to perform advanced calculation on your Gravity Forms data using the [gravitymath] shortcode.

For example, this shortcode adds two values together and divides them by 365:

[gravitymath scope="form" id="52"] ( {Number:1} + {Number:3} ) / 365 [/gravitymath]

Creating complex calculations by nesting multiple shortcodes

With GravityMath 2.2, you can nest multiple [gravitymath] shortcodes. In other words, you can add a [gravitymath] shortcode inside another [gravitymath] shortcode! This allows you to use data from multiple forms in one calculation.

Here's an example: we're using two different forms to calculate the amount due from a client for support questions (billed at $100/question) and VIP support requests (billed at $200/request) respectively. The below calculation adds these values together.

Total due from client: $[gravitymath] 
  [gravitymath2 scope="form" id="12"] {Support Questions:2:count} * 100 [/gravitymath2] + [gravitymath2 scope="form" id="4"] {VIP Support Requests:4} * 200 [/gravitymath2]
[/gravitymath]

⚠️ You cannot use the same shortcode inside itself: the closing tag ( [/gravitymath]) will stop the shortcode from processing! Use [gravitymath2], [gravitymath3] instead.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us