math function library

I’d like to get the result of formula like ‘2*3+1’ which is stored in a variable of type text. The EVALUATE function of Navision cannot handle this so I thought about an external component which can be used via the SHELL function or via automation. Any hints?

I think you can solve this as well by looping with a navision routine. Little hint: VAR: counter = integer char = text[1] textvar = text[100] REPEAT Counter := Counter + 1; Char := CopyStr(TextVar, Counter, 1); // retreive next char from text var <do things with char here (evaluate, detecting math sings etc,)> UNTIL (Counter = STRLEN(TextVar));

Hi Is there really no way to calculate this within Navision? Sure you can do this e.g. with Excel Automation like this: xlRange.Formula := '=' + YourFormulaText; YourResult := xlRange.Value; But is this not to much for a simple calculation? Only a joke: Try to calculate it with Google [:D]. bye André

I’m not really sure if this is in the standard/your version, but you could check out CU 8 (KontoschemaVerwaltung in our German version). This CU contains a function to evaluate the formulas you can define in the G/L sheet (Fibu->Kontenschema). It contains a lot of stuff dealing with the G/L specific options, but it should give you an idea of how to do expression evaluation in C/AL.

I can remember once being faced with the same problem. At the time, it was resolved by actually passing the expression to excel to resolve (via automation). If only I had known about CU8 at the time though, very useful!! Regards, edd.