Skip to content
GravityKit
Buy
Sign in
0 items
  • Plugins

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data between sites, including forms, entries, settings, Views, feeds, and file uploads, and import forms from other form plugins.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • Be There Local
    • Killer Shorts
    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    View All Case Studies
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    Ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
  • Plugins

    • GravityView

      GravityView

      Bestseller

      Display Gravity Forms entries on the front-end of your site and build powerful web applications.

    • GravityImport

      GravityImport

      Trending

      Import entries from CSV files into Gravity Forms to transfer data, create new forms, or update existing entries.

    • GravityEdit

      GravityEdit

      Quickly edit Gravity Forms entries inline to save time, reduce clicks, and streamline your workflow.

    • GravityCharts

      GravityCharts

      Trending

      Turn Gravity Forms entries into interactive charts and graphs.

    • GravityActions

      GravityActions

      Update multiple Gravity Forms entries at once, send bulk emails, and streamline your workflow.

    • GravityCalendar

      GravityCalendar

      Turn Gravity Forms entries into dynamic calendars to showcase events, schedules, appointments, and more.

    • GravityExport

      GravityExport

      Export Gravity Forms entries to Excel, CSV, PDF, or Google Sheets, then share them with secure links or deliver them to cloud storage on a schedule.

    • GravityMath

      GravityMath

      Perform advanced calculations on Gravity Forms entries to display totals, averages, or build custom calculators.

    • GravityRevisions

      GravityRevisions

      Track, compare, and restore changes made to Gravity Forms forms and entries with a full version history.

    • GravityMigrate

      GravityMigrate

      Migrate all Gravity Forms data between sites, including forms, entries, settings, Views, feeds, and file uploads, and import forms from other form plugins.

    • GravityBoard

      GravityBoard

      Manage projects with collaborative project management. Coordinate with your team and streamline your workflows.

    • GravitySearch

      GravitySearch

      Search Gravity Forms entries across every form from one screen.

    View All Products

    GravityKit All Access

    Our complete Kit of essential tools for extending and enhancing Gravity Forms—everything you need to build powerful web apps and workflows.

    Learn more
  • Ideal For

    • Nonprofits
    • Web Agencies
    • Education
    • Developers
    • Small Businesses
    • Startups
    Explore All Use Cases

    Case studies

    • Be There Local
    • Killer Shorts
    • West Fork Schools
    • Princeton University
    • BrightLeaf Giving
    • Jacksonville Port Authority
    • National Severe Storms Lab
    • Leadpal
    View All Case Studies

    How to build...

    • Client Portal
    • AI-Built Directory
    • Conference Website
    • WordPress CRM
    • Admin Dashboard
    • Inventory Management
    • Vendor Portal
    • Document Library
    View All Guides
  • Resources

    • Blog
    • Case studies
    • Newsletter
    • GravityKit vs competitors
    • Live Demos
    • Documentation
    • Developer docs
    • GravityKit Academy

    ultimate guides

    • How to use Gravity Forms
    • Editing Gravity Forms entries
    • Importing Gravity Forms entries
    • Exporting Gravity Forms entries
    • Displaying Gravity Forms entries
    • Gravity Forms conditional logic
    • Gravity Forms calculations
    View More Articles
  • Support
  • Pricing
0 items

Search

Results appear automatically as you type.
Loading results…

results found matching

    Sign in
    Buy

    Docs

    • Docs Home

    Gravity Forms Add-Ons

    • GravityView
    • GravityActions
    • GravityBoard
    • GravityCalendar
    • GravityCharts
    • GravityEdit
    • GravityExport
    • GravityImport
    • GravityMath
    • GravityRevisions
    • GravitySearch
    • GF Widget for Elementor
    • GF Dynamic Lookup
    • GF Entry Tags
    • GF Event Field
    • GravityExport Lite
    • GF Zero Spam
    • GravityMigrate

    GravityView

    • Getting Started
    • View Setup
    • FAQ
    • Pre-Sale
    • Advanced
    • Common Problems
    • Customizing Your Views
    • Edit Entry
    • Entry Approval
    • Filter and Sort Results
    • Gravity Forms
    • Merge Tags
    • Roles and Capabilities
    • Search
    • Shortcodes
    • View Settings
    • WordPress Posts

    General Help

    • Account, Invoices, and Billing
    • License Related
    • Plugins and Settings
    • Agency accounts
    • Contact
    • Docs Home
    • Gravity Forms Add-Ons

      • GravityView
      • GravityActions
      • GravityBoard
      • GravityCalendar
      • GravityCharts
      • GravityEdit
      • GravityExport
      • GravityImport
      • GravityMath
      • GravityRevisions
      • GravitySearch
      • GF Widget for Elementor
      • GF Dynamic Lookup
      • GF Entry Tags
      • GF Event Field
      • GravityExport Lite
      • GF Zero Spam
      • GravityMigrate
    • GravityView

      • Getting Started
      • View Setup
      • FAQ
      • Pre-Sale
      • Advanced
      • Common Problems
      • Customizing Your Views
      • Edit Entry
      • Entry Approval
      • Filter and Sort Results
      • Gravity Forms
      • Merge Tags
      • Roles and Capabilities
      • Search
      • Shortcodes
      • View Settings
      • WordPress Posts
    • General Help

      • Account, Invoices, and Billing
      • License Related
      • Plugins and Settings
      • Agency accounts
    • Contact

    GravityMath

    • Add calculations to blog posts
    • Calculate the time between two dates with [gravitymath]
    • Calculating Survey fields totals based on their scoring
    • Calculations in GravityView
    • Can GravityMath be used inside a Gravity Forms form?
    • Can I use [gravitymath] with [gvlogic]?
    • Can I use [gravitymath] with Multiple Forms?
    • Debugging calculations in GravityMath
    • Developer Hooks for GravityMath
    • Does GravityMath support the Polls Add-on?
    • Does GravityMath support the Survey Add-on?
    • GravityMath Calculation field
    • How to add field calculations to the table footer
    • How to Calculate the Sum of a Field in Gravity Forms
    • How to display summaries using a block, widget, or shortcode
    • How to enable duration calculations in Gravity Forms with GravityMath
    • How to perform Gravity Forms time calculations in GravityView using GravityMath
    • Math filters: targeting a specific field value with [gravitymath]
    • Nested calculations in GravityMath
    • Pricing fields calculation
    • Sum GravityMath values for today, a custom date range, or a rolling window
    • The [gravitymath] shortcode
    • The {entry_count} merge tag in GravityMath
    • Using GravityMath inside a GravityView Custom Content field
    • When to use GravityMath and when to use GP Advanced Calculations
    • Home
    • Docs
    • GravityMath
    • Debugging calculations in GravityMath

    Debugging calculations in GravityMath

    Estimated reading: 3 minutes

    Updated on October 20, 2026

    When a [gravitymath] shortcode prints nothing, or a number you don’t expect, turn on debugging. GravityMath then puts a numbered link after each result and adds a report after the page’s content. The report shows each formula before and after GravityMath filled in its merge tags, with the errors and warnings for that shortcode. Only administrators and editors see the links and the report. Visitors see the page as usual.

    Debug one shortcode

    Add debug="true" to the shortcode:

    [gravitymath scope="form" id="27" debug="true"] {Hours:3:sum} * 80 [/gravitymath]

    In a View, open the settings of the Custom Content field that holds the shortcode and add the attribute there:

    The Custom Content field settings in the View editor, with debug="true" added to a [gravitymath] shortcode

    Debug every shortcode on a page

    Add ?gv_math_debug=true to the page’s address. Nothing in the shortcodes changes, so this suits a View with calculations in several fields:

    https://example.com/my-page/?gv_math_debug=true

    If the address already has a ?, add &gv_math_debug=true at the end instead.

    Debug every shortcode on the site

    In wp-config.php, change define( 'WP_DEBUG', false ); to define( 'WP_DEBUG', true );. Then add this line above /* That's all, stop editing! Happy publishing. */:

    define( 'GV_MATH_DEBUG', true );

    The report shows only while WP_DEBUG_DISPLAY is on, which is the WordPress default. WordPress then also prints PHP errors on your pages for every visitor, so use this on a staging site.

    Turn debugging on or off with code

    The gravityview/math/debug filter decides whether debugging is on. This turns it on for every shortcode, and only administrators and editors see the report:

    // Turn on debugging for every [gravitymath] shortcode.
    add_filter( 'gravityview/math/debug', '__return_true' );

    To turn debugging off everywhere, even for shortcodes with debug="true", use '__return_false' instead.

    Read here how to add these code samples to your website: Where to put code samples.

    Read the report

    Each result gets a link such as [0] after it, numbered in the order the shortcodes appear on the page. The link jumps to that shortcode’s box in the report. The report starts with the line “You can only see this message because you are logged in and have permissions.” Each box lists:

    • The errors and warnings for that shortcode, if there are any. Common messages explains them.
    • “Formula before parsing”: the formula as written. In a View’s Custom Content field, GravityView has already put in the entry’s values.
    • “Processing with attributes”: the scope and id GravityMath used.
    • “Formula after parsing”: the formula with every merge tag replaced by a number. This is what GravityMath calculates.

    Click (Additional info) after a line to see its details, such as the shortcode’s attributes or the entries involved.

    A View of support tickets with a numbered debug link after each amount, and the report below it. The box for the row with no hours reads: Error: Unexpected token "*" at line 1 and column 1

    In this View, Tom Hughes has no hours, so his formula reads * 80 before parsing and GravityMath can’t calculate it.

    Common messages

    MessageWhat it means
    Error: Unrecognized tokenThe formula holds text GravityMath can’t calculate. Outside a View, a shortcode with no scope causes it, because its merge tags stay in the formula.
    Error: Unexpected tokenThe formula is incomplete, such as a + with nothing after it. In a View, a field that is empty in that entry leaves a gap in the formula, such as * 80.
    No ID provided, form scope requires an ID to process the formula.The shortcode has scope="form" or scope="view" but no id. The message names the scope.
    Field not valid for calculationThe form has no field with the ID in brackets, or GravityMath can’t calculate with that type of field, such as a Date field. After the message, the form ID opens the form editor.
    A field in the calculation did not contain a valueWith scope="entry" and an id, the field in brackets is empty in the entry listed, and the shortcode prints nothing. With scope="form", a filter and debug="true" on the shortcode, the same line lists the entries the filter left out, whether or not their field is empty.
    The [gv_math] formula was emptyThe shortcode has nothing between its tags and no formula attribute.
    No View was foundThe id of a scope="view" shortcode is not a View.

    Show visitors that a result may be wrong

    notices="true" marks a result for everyone, without the report:

    [gravitymath scope="form" id="27" notices="true"] {Hours:3:sum} [/gravitymath]

    A result with a warning gets * after it, and a calculation that fails shows **. The end of the page then reads “* Results may not be accurate.” or “** No Results Currently Available.” With debugging on, administrators and editors see the report instead.

    To change these texts, use the filters gravityview/math/accuracy_message, gravityview/math/no_results_message and gravityview/math/admin_notice (the line above the report).

    Still stuck? How can we help?

    How can we help?

    "*" indicates required fields

    This field is for validation purposes and should be left unchanged.
    Replies will go to this email.
    How can we help?*
    My pre-sale question is related to...*
    My WordPress skills are....*
    My Gravity Forms skills are...*
    You will be shown articles from our documentation.
    Vous pouvez nous écrire dans votre langue maternelle si c’est plus facile pour vous—nous nous occuperons de la traduction!
    Puedes escribirnos en tu idioma nativo si te resulta más fácil; ¡nosotros nos encargamos de la traducción!
    Sie können uns in Ihrer Muttersprache schreiben, wenn das für Sie einfacher ist – wir kümmern uns um die Übersetzung!
    U kunt ons in uw moedertaal schrijven als dat gemakkelijker voor u is — wij zorgen voor de vertaling!
    Du kan skrive til oss på ditt morsmål hvis det er enklere for deg — vi tar oss av oversettelsen!
    Du kan skriva till oss på ditt modersmål om det är lättare för dig — vi tar hand om översättningen!
    Você pode nos escrever em seu idioma nativo se for mais fácil para você — nós cuidaremos da tradução!
    Puoi scriverci nella tua lingua madre se ti è più facile — penseremo noi alla traduzione!
    Please provide as much detail as you're able; this helps us provide you with faster support.
    Drop files here or
    Accepted file types: jpg, jpeg, gif, png, tiff, pdf, bmp, zip, json, csv, xls, xlsx, Max. file size: 256 MB.
      Get better at Gravity Forms every Friday

      Was this page helpful?

      Table Of Contents
      • Debug one shortcode
      • Debug every shortcode on a page
      • Debug every shortcode on the site
      • Turn debugging on or off with code
      • Read the report
      • Common messages
      • Show visitors that a result may be wrong
      GravityKit
      • How to Build It
      • GravityKit vs competitors
      • Pricing
      • Products
      • Our Team
      • Our Values
      • Work With Us
      • Partner Directory
      • Coupons
      Support
      • Support
      • Contact
      • Documentation
      • Scope of Support
      • Brand Guidelines
      • Brand Kit
      • Privacy Policy
      • Terms of Service (“Terms”)
      I am a...
      • Nonprofit
      • Web agency
      • Small business owner
      • Web developer
      • Educational institution
      • WordPress freelancer
      • Startup founder
      • One-person agency
      Get notified of updates.

      We’re constantly improving GravityKit. Fill out your email below and we’ll notify you anytime major updates drop.

      See past editions
      • Facebook
      • Twitter
      • Mastodon
      GravityKit is a Gravity Forms Certified Developer.

      Copyright © 2026, Katz Web Services, Inc.

      GravityKit and GravityView are registered trademarks of Katz Web Services, Inc.