Book a Demo

Author Topic: transformation template aritmetic operations  (Read 4548 times)

shadowmulder

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
transformation template aritmetic operations
« on: May 09, 2012, 10:05:36 pm »
Hi
I am transforming a physical model into a logical.

for one string manipulation I need a arithmetic operation (MINUS):

Code: [Select]
//e.g. find first occurence of _
$NameFirstUnderline = %FIND(attName,"_")%
//remove prefix
$Prefix = %LEFT(className,$NameFirstUnderline-1)%

how I decrease the index?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: transformation template aritmetic operations
« Reply #1 on: May 09, 2012, 10:27:51 pm »
Long time ago I used that so my knowledge may be outdated. The transformation is rather limited and IIRC it is not possible to make math. But you can call a user-defined add-in function to do that for you.

q.

shadowmulder

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: transformation template aritmetic operations
« Reply #2 on: May 09, 2012, 11:19:51 pm »
Interesting, can you give me a little more info about that:
A link or a menu entry where I can find that

in what language this functions are written?

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: transformation template aritmetic operations
« Reply #3 on: May 10, 2012, 12:57:21 am »
Hi,

Look here http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/standard_uml_models/functionmacros.html for the EXEC_ADD_IN() macro.
BTW, for an actual project of mine I decided to generate the complete transformation intermediary language using AddIn function(s), because the transformation templates don't fit very well for my purposes.

You can write AddIns in any language that supports creating COM interop enabled DLLs. I personally prefer C# for this ...

WBR
Günther

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: transformation template aritmetic operations
« Reply #4 on: May 10, 2012, 06:44:12 am »
Quote
BTW, for an actual project of mine I decided to generate the complete transformation intermediary language using AddIn function(s), because the transformation templates don't fit very well for my purposes.
Welcome to the club :-) I did exactly the same some years ago and would do that again next time it's needed.

q.

Takeshi K

  • EA User
  • **
  • Posts: 632
  • Karma: +43/-1
    • View Profile
    • Sparx Systems Japan
Re: transformation template aritmetic operations
« Reply #5 on: May 10, 2012, 10:47:57 am »
Hello all,


Maybe the following will solve the question.

$result = %MATH_ADD($NameFirstUnderline,"-1")%
$Prefix = %LEFT(className,$result)%

(It may be limited to some upper editions.)

Hope this helps,
--
t-kouno

shadowmulder

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: transformation template aritmetic operations
« Reply #6 on: May 17, 2012, 12:12:26 am »
thx to you all, this helped!

the possibility to add some helper is good for deeper things

the MATH_ADD is really helpfull, why is this not in official reference? or why it cant be found over STRG+SPACE ? >:(

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: transformation template aritmetic operations
« Reply #7 on: May 17, 2012, 02:41:14 am »
Sometimes they add more features than the documentation guys can handle (which is not necessarily an advantage). However, EA's documentation is outstanding compared to most other SW I know. Probably Roy will read this post too and update the documentation.

q.

shadowmulder

  • EA Novice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: transformation template aritmetic operations
« Reply #8 on: May 18, 2012, 07:14:21 pm »
I like EA, because it is a quick and stable SW, but to be honest, I know SW which has definitely better documentation (updated, structured and more understandable). What I also miss is more docu from outside (blogs, tutorials). The templating language is a blind flight, I use it only because it brings a big advantage.
But the forum gave me a quick answear  ;) thx