Jump to content
Sign in to follow this  
DrJeseuss

How could I use a formula stored as a string?

Recommended Posts

DrJeseuss

I need to grab formulas from an XML file, then process a variable using the formula. For example:

<Word Number="1" Type="Dec" Formula="$n=$n*25" />
<Word Number="2" Type="Dec" Formula="$n=($n + 28.06)/2.71" />
<Word Number="3" Type="Dec" Formula="$n=$n*5/256" />

I can get the formula pulled from XML without a problem but I then have strings:

$formula1 = "$n=$n*25"

$formula2 = "$n=($n + 28.06)/2.71"

$formula3 = "$n=$n*5/256"

I could use StringTrim to get it down to Formula1 = "$n*25" then say $n = $formula but since formula's a string, I just end up with a copy of the formula string as $n. Would anyone know how to handle something like this? Thanks!

Share this post


Link to post
Share on other sites
ProgAndy

You could try Execute :P


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
DrJeseuss

You could try Execute :P

Thanks! I looked everywhere (so I thought) for that! Works like a charm.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.