1
votes

I'm trying to create a Lotus Notes application using Lotusscript that can take a mathematical equation stored as a text string and evaluate it to return the answer. This seems so basic but I just can't figure it out for the life of me.

As an example, I have a document with the following text in a field "(3*3)^2". Evaluated, that should return 81.

I know Lotusscript is capable of solving that equation because a print statement "Print (3*3)^2" prints 81. I just can't get figure out any way to take the string and have Lotusscript treat it as a formula.

And unfortunately, because of the application, I can't use the Evaluate statement because that would require storing Lotus Notes formulas which require @functions for most math functions. And that pretty much ruins the purpose of this application.

I think I've looked a it too long and have begun to over complicate it. I've tried changing data types, using INCLUDEs, streaming the equation to Google, and even using OLE to get the answer using Excel. But none of these return practical solutions. I'm thinking I must be overlooking something really simple.

Any suggestions how I can do this?

1

1 Answers

2
votes

Never-mind. As soon as I stopped thinking about it, the answer came to me.

I just needed to use the Execute command to compile and execute the expression as a temporary module. I knew it was something simple.