Hi All,
Does anybody know how to do substitution of variables in string expressions.
E.g.
TXT = 'a*b + c*2'; // TXT is a string
a := 10;
b := 5;
c := 7;
d:= FUNCTION(TXT);
// is there any function which will substitute a, b & c of the string with the corresponding variables and evaluate the expression and set value of d to 64 [10*5 + 7*2]
Please help. Thanx in advance
ARUN
0
Comments
And then use the DLL of MS Excel to calculate the result in Excel and get it back to Navision.
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!
Using kriki's suggestion would be much easier (using Excel in the background to do the calculation).
Thank you very much for your answers.
I was actually looking for something within navision.
Thanx again.
ARUN
I used Luc's idea and created a codeunit that looks like this
You would of course delete the OnRun function and only run the codeunit as follows
Text := STRSUBSTNO('%1 * %2 + %3 * 2',a,b,c);
d := c.passtext(text);
Maybe you could use this or if need be I can mail you the fob file.
Albert
my mail id is: soumyadip AT rediffmail DOT com
Thank you