[WD] Is there something like a parser?

Startbeitrag von Markus K. am 30.07.2013 10:07

Hi all,

i want to build a function to let the user build dynamically formulas for articles with different types. For example the user can define 3 values: lenght, width and area. In area the user enters the formula [lenght] * [width].
When the user creates a position within an order the values are requested and the area should be calculated automatically. Therefore i need to replace the [lenght] and [width] with the entered values and parse the result. And the entered formula should be parsed too (with test values) to see if the term is valid.
To calculate the area is simple but for more complex terms i need to respect multiplication and division first, then addition and subtraction, so a parser would be very helpfull.
Is there something like that available?

Thanks in advance and greetings


Hi. You can use the Compile, Execute and ExecuteCode. Look at help.


von Ruben Sanchez Peña - am 30.07.2013 12:15
Thank you Ruben,

i found with your hints the function EvaluateExpression which is exactly what i need.


von Markus K. - am 30.07.2013 16:20
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.