humdek-unibe-ch / sh-shp-formula_parser

The plugin is based on (MathExecutor)[https://github.com/neonxp/MathExecutor]. It supports all the operators and functions that are supported in MathExecutor. The plugin uses (MathPHP)[https://github.com/markrogoyski/math-php] for additional math functions
0 stars 0 forks source link

SelfHelp plugin - Formula Parser

The plugin add field formula the styles markdown, dataContainer and loop to enable mathematical formulas. Use the field formula of the style markdown to define the mathematical operations. The plugin is based on (MathExecutor)[https://github.com/neonxp/MathExecutor]. It supports all the operators and functions that are supported in MathExecutor. The plugin uses (MathPHP)[https://github.com/markrogoyski/math-php] for additional math functions.

Additional functions:

[
    {
        "formula": "sum(1,2,3)",
        "result_holder": "sum"
    },
    {
        "formula": "sum([1,2,3])",
        "result_holder": "sum2"
    }
]
[
    {
        "formula": "date_format(['2023-12-22 14:23:29','2023-12-22 14:27:29'], 'Y-m-d')",
        "result_holder": "formatted_dates"
    }
]
[
    {
        "formula": "count(array($arr))",
        "result_holder": "arr1_length",
        "variables": {
            "arr": "{{record_id}}"
        }
    }
]
[
    {
        "formula": "explode('1,2,2,3,2,1',',')",
        "result_holder": "exploded_array"       
    }
]
[
    {
        "formula": "array_filter_by_value(['1','2','1', '3'],$filtered_value)",
        "result_holder": "filtered_array",
        "variables": {
            "filtered_value": "1"
        }
    }
]
[
   {
      "formula": "modify_date(['2024-03-19', '2024-03-22'], 'Y-m-d', '+1 day', 'Y-M-D')",
      "result_holder": "mod_date"
   },
   {
      "formula": "modify_date('2024-03-19', 'Y-m-d', '+5 day')",
      "result_holder": "sing_d"
   }
]
[
   {
      "formula": "is_user_in_group('subject')",
      "result_holder": "is_in_subject"
   }
]

Installation

Requirements