How to force numbers to sort properly

When given $20,000, $2,000 and $20, Gravity Forms will sort the array like this: $2,000, $20, $20,000 because Gravity Forms is alphabetically sorting the numbers rather than sorting by value. The numbers 1, 2, 5, 10, 30 will be sorted as 1, 10, 2, 30, 5.

This is a known issue with Gravity Forms. We've reported the issue, and rocketgenius hope to include the fix in Gravity Forms Version 2.0.

Until the day the issue is fixed by Gravity Forms, here's how to solve the sorting issue using GravityView.

Add a number field to the Gravity Forms form


Check the "Enable Calculation" box


Enter a calculation that will result in a fraction

The key is to have the absolute largest number result in a calculation of less than 10. Anything up to 9.99999 will work.

It's perhaps cleanest to divide by the largest number, or by a factor of ten.

If you have numbers up to 1000, you could divide by 1000. If you have numbers up to 300, you could divide by 300. If you have a rating scale of 1-10, you could divide by 10 so that your rating scale becomes .1 to 1.


Update the Form


Edit the View you want sorted

Go back to the View you were working on.

Optional: Add the Field to your View

If you want to display the value on your View, you can add the field.


Update the Sort by Field value

Use the new Calculation field as the "Sort by Field" value.