Sparx Systems Forum

Enterprise Architect => General Board => Topic started by: Physicus on January 31, 2006, 01:04:35 am

Title: Math calculations within code generation templates
Post by: Physicus on January 31, 2006, 01:04:35 am
Is it possible to perform (simple) math calculations with the variables of the code generation templates, like addition or subtraction f.i. ?
e.g. I have two variables:
$var1 = "5"
$var2 = "3"
and I want to fill the (mathematical) difference in a third variable:
$var3 = $var1 - $var2
Now var3 contains "5 - 3", but I want that it contains "2".
Of course it's due to the fact, that these variables are strings - but is there any possibility to perform the desired calculations?

Thanks in advance!
Title: Re: Math calculations within code generation templ
Post by: Eve on January 31, 2006, 01:05:39 pm
No.  There isn't any way to do any sort of arithmetic in the code templates.

Well, that's not quite true.  You can be calling an addin.  (Search for EXEC_ADD_IN)
Title: Re: Math calculations within code generation templ
Post by: Physicus on February 01, 2006, 09:00:47 am
@simonm:

Thank you very much. After a longer try I found out how it works.

Best Regards.