MaxLazar/mx-calculator

Feature requests

Opened this issue · 1 comments

I would like to request some features:

  • use variables (template variables, template partials, low variables) & exp:tags (like stash) as number values to do calculations on
    • eg: {exp:mx_calc expression="{grid_field:numbers_column} * {template_variable} + {exp:stash:get:value} / {template_partial}"} where the variables are numeric values
  • support parse='inward' for above example
  • be able to set the number of decimals
    • eg via a parameter: decimals='2'
  • be able to force decimals if round number
    • eg via parameter: force_zeros='yes'
  • set decimals separator: decimal_seperator=','
  • set thousands separator: thousand_seperator='.'
  1. is no magic solution here due to EE parsing order. It would be needed still play with tag order templates. But MX Calc v. 3.0.5 now has variables and a late parsing option, which should help to build more flexible solutions. I will do extra R&D for future versions.

  2. It was not documented (my bad), but it was always possible to do a number format

{exp:mx_calc expression='number_format(12123.1, 2)'}
output : 12,123.10

{exp:mx_calc expression='number_format_eu(120993, 2)'}
output: 120 993,00