Here is an example of how it should be handled (from Sidax:
www.axaptapedia.com/Sidax)
void runIt(str _src)
{
XPPCompiler comp=new XPPCompiler();
;
if(comp.compile(_src))
this.write(runBuf(_src, element));
else
info(comp.errorText());
}
//this.write is the actual output of the calculated value
--- In [email protected], "Ieva Romancike"
<[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I have formula as string (for example, "100+12-8-3"). Currenly, I
use
> evalbuf () to get it's value and convert it to real afterwards.
> However, I want to make some checking to make sure my formula is
> correct. Example of incorrect formula: "100+(10-5))".
Unfortunately,
> formula like this just crashes axapta (I use evalbuf() inside
> ttsbegin..ttscommit statement). Is there a way to check if formula
is
> valid, and if it is not, just return 0?
>
> I've tried try{..} catch {..}, but it works only on division by
zero.
>
> Any ideas would be greatly appreciated.
>
> Regards,
> Ieva
>
>
> [Non-text portions of this message have been removed]
>