# Changelog ## 1.1.3 | August 27, 2024 - Fixed issue where decimal comma numbers would be treated as strings in some formulas. - Fixed issue with unicode characters used in string comparisons. - Fixed issue where partially numeric values (e.g. number ranges with dash, Zip + 4, etc.) could get treated as numbers rather than strings in conditional statements. ## 1.1.2 | August 14, 2024 - Added support for new `:choice_label` modifier to explicitly get the label from a choice in a formula as Advanced Calculations will default to getting the value of the choice. `:label` is for getting the label of the field itself. - Refactored calculation logic to resolve regressions including the `:value` modifier not being used by default as well as addressing currency-formatted numbers being treated as strings in some cases. - Added `test_complex_calculations.cy.ts` ## 1.1.1 | July 31, 2024 - Fixed regression where currency values could be treated as strings resulting in incorrect calculations. ## 1.1 | July 23, 2024 - Added support for comparing strings in `if` / `elseif` statements. ## 1.0.23 | June 26, 2024 - Fixed issue where values starting with `0` could get evaluated as octals. ## 1.0.22 | June 20, 2024 - Fixed JavaScript error in the form editor if using Firefox that could cause the merge tag selector to not initialize. ## 1.0.21 | May 22, 2024 - Added new [`gpac_functions`](https://gravitywiz.com/documentation/gpac_functions) PHP and JavaScript filter hooks for adding custom functions. - Added trigonometric functions: `sin`, `cos`, `tan`, `asin`, `acos`, `atan`. ## 1.0.20 | May 9, 2024 - Fixed issue where Merge Tag Shorthand would not calculate when a key is pressed at consistent times on some devices. ## 1.0.19 - Fixed issue where `max()` and `min()` could calculate as `0` during submission if only given one parameter. ## 1.0.18 - Improved error handling when improper parameters are provided to functions such as `min`, `max`, etc. - Fixed an issue where calculations encountering division by zero would throw an error instead of returning `0`. ## 1.0.17 - Updated the "Validate Formula" override to be more robust which fixes an issue with it not after Gravity Forms 2.8.2. ## 1.0.16 - Fixed issue where Merge Tag Shorthands would use pricing field choice values instead of prices which does not match the default Gravity Forms behavior nor how it would be handled after submission. If you wish to use a pricing field choice's value, you will need to switch from the shorthand to a full merge tag with a modifier such as `{:1:value}`. ## 1.0.15 - Fixed another issue where omitting a leading zero on a decimal would cause calculations to not work as expected. ## 1.0.14 - Fixed issue where a JavaScript error could occur if calculations are enabled for a field, but the formula is empty. ## 1.0.13 - Fixed issue where the calculation before and after submission would not match in some situations where decimal numbers do not have leading zeros. ## 1.0.12 - Fixed a potential conflict with Beaver Builder. ## 1.0.11 - Fixed issue with frontend calculations for functions such as `fv` not being correct in some cases. ## 1.0.10 - Improved the algorithm used to process functions in formulas to handle more complex nesting. - Fixed issue where parse errors in formulas could prevent the form from rendering in some cases. Additionally, logging has been improved to help track down which fields and formulas are not evaluating correctly. ## 1.0.9 - Fixed issue where using a value from Date Time Calculator inside a function such as `floor()` would not work as expected. - Improved exception handling of malformed formulas on the frontend. ## 1.0.8 - Fixed issue where shorthand variables would sometimes behave inconsistently on more complex forms. ## 1.0.7 - Fixed issue where `!=` operator was not working correctly in conditionals. ## 1.0.6 - Fixed issue with modulo (`%`) operator not working correctly after submission. ## 1.0.5 - Fixed issue where shorthands in formulas would not work as expected if multiple formulas used the same shorthand field variable. ## 1.0.4 - Updated the priority at which we process calculations to allow other plugins to modify the formula first. ## 1.0.3 - Fixed issue where shorthand variables would stop working if Populate Anything refreshed any fields used in the formula. - Fixed issue where shorthand variables could incorrectly replaced by partial matches. As an example, `F43` could be replaced with the value of `F4` if it was processed first. ## 1.0.2 - Added new [`gpac_should_clean_merge_tag_value`](https://gravitywiz.com/documentation/gpac_should_clean_merge_tag_value) JavaScript filter. ## 1.0.1 - Fixed issue where exponents did not support raising a number by a power containing a function. - Fixed an issue where exponent results between frontend and after submission could be inconsistent when parentheses and functions are used. - Added internationalization to strings in Advanced Calculations so they can be translated. ## 1.0 - Added new `pi()` function that returns π to a precision of 20 decimal places. - Fixed issue where the Formula Cheatsheet link was not present in Gravity Forms 2.4. Additionally, the "Validate Formula" button now works as expected with Gravity Forms 2.4. - Added support for conditionals with multiple conditions such as `if ( ({Number C:5} < -15) || {Number C:5} > 10 )`. - Added support for field variables with modifiers such as `{Nested Form A:4:total}` ## 1.0-beta-1.0 - Added syntax highlighting/validation support for Date Time Calculator's merge tags such as `{weekdays:}` and `{weekendDays:}`. - Updated cheat sheet. - Added spaces inside parentheses for function/conditional completions and in the cheatsheet. - Added a "Formula Cheatsheet" below the formula editor that opens a modal containing information about how to write the formulas. - Added support for shorthand field variables in formulas (e.g. F1 for field 1 and F5.5 for input 5.5) - Added new editor to the Calculation Formula field setting that can handle validation and syntax highlighting. - Added average() function. - Added FV (future value) function. Signature: FV(rate, numberOfPeriods, paymentAmount, presentValue, endOrBeginning) - Fixed issue where wrapping function calls in parentheses preceding by a negative symbol would not work. - Added support for using exponents/functions inside conditionals - Fixed issue where conditionals couldn't contain equal signs after improving security around eval(). - Improved support for nested function calls. - Fixed issue where addition inside parentheses/functions was not being processed. - Updated existing log() function which was a natural log to be ln(). log() is now base 10. Additionally, exp() is now an available function. - Added "Update URI" to plugin header to improve security. ## 1.0-alpha-1.0 - Fixed issue where passing parentheses into function parameters or values that are replaced with values containing parentheses would not calculate correctly. - Added more functions: sqrt(), round(), ceil(), floor() - Fixed decimal numbers breaking formulas. - Improved functions to be case-insensitive. ## 0.10.1 - Fixed issue where Enhanced Calculations would not work if there are multiple forms on the same page using calculations. - Added support for elseif's in conditionals. - Added support for min and max functions. Example: `max({Number A:1}, {Number B:2}, 5*50)` - Fixed issue where backend calculations would not match frontend calculations in some cases. - Fixed issues with currency values in conditions. - Fixed issue where empty fields could cause errors when evaluating formulas.