Book a Demo

Author Topic: Custom Transform Function Macro  (Read 3689 times)

Rollie

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Custom Transform Function Macro
« on: January 28, 2009, 01:39:36 pm »
Is it possible to write a custom transform function macro?  I have no problem using the EA supplied function macros, but I cannot find any documenation on writing a custom function macro.  I have some transformation logic that needs to be called by more multiple templates and needs to return a string.  I would rather not duplicate the code in each template.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Custom Transform Function Macro
« Reply #1 on: January 29, 2009, 08:41:56 am »
You can do it with custom templates (http://www.sparxsystems.com/uml_tool_guide/sdk_for_enterprise_architect/customtemplates.html)

You can pass parameters in to custom templates of type <none>, but I don't think it's made it into the documentation.

Look at the Java transformation for an example of this.  The Properties custom template is called from Attribute__AsProperties and Linked Attribute.

Rollie

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Custom Transform Function Macro
« Reply #2 on: January 29, 2009, 08:56:23 am »
Simon, I am familiar with calling a Macro, but I have not found any example that shows how to return a value to the calling macro.  I have some custom name formatting that I need to apply from multiple macros.  Rather than pasting the same logic in each macro, I would like to pass the name to a custom function macro, and have it return the string value of the properly formatted name so that it can be applied to different element types.  Is it possible to have a custom macro return a variable to the calling macro, making it a custom function?
Thanks

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Custom Transform Function Macro
« Reply #3 on: January 29, 2009, 08:59:41 am »
The text that the template generates is what is returned/substituted.
« Last Edit: January 29, 2009, 09:00:38 am by simonm »

Rollie

  • EA User
  • **
  • Posts: 22
  • Karma: +0/-0
    • View Profile
Re: Custom Transform Function Macro
« Reply #4 on: January 29, 2009, 09:05:37 am »
The light just came on.  I was looking for a return, send, result or some other keyword to return the contents of the variable.  I had assumed that text that is generated from a macro went directly to the intermediate file, I did not see any documentation that states if it is wrapped or being assigned, then it does not generate to the intermediate file.  Thanks again.