Extend calculation field parsing

Currently the calculation field only supports basic arithmetics (addition, subtraction, division and miltuplication) at least that what I found in the JS file.

My personal need is the ability to write conditional calcualtions either with something like if or ternary operator (?).

If I’m not wrong you could use something like Math.js as it looks like it supports parsing of pretty advanced operators one of them is conditional one “? :” as described here: math.js | an extensive math library for JavaScript and Node.js

Hey @Matiasko :raising_hand_man:t2: Thanks for your input. We do the calculations on server side. What you’ve found in the JS code are only the post calculations when using the Dynamic Data to output the result somewhere else. For the main calculations, Bricksforge uses the Shunting Yard algorithm and Reverse Polish Notation (RPN) to perform them. We are also working on adding the possibility to include conditionals in the formula in a future version.

If you have any further questions, please don’t hesitate to reach out to us. :relaxed:

1 Like