Book a Demo

Author Topic: MDA - assign columns to operations ?  (Read 4051 times)

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
MDA - assign columns to operations ?
« on: April 07, 2010, 09:15:34 pm »
I try to add indizes automatically to tables when transforming into a SQL2005 database schema.

I refer to the documentation:

Quote
1. Right-click on the required table either in a diagram or in the Project Browser.
2. Select the Operations context menu option. The Operations dialog displays.
3. Add an operation (with a name such as IDX_CustomerID; the IDX_ prefix is optional but it helps identify the operation).
4. In the Stereotype field for the operation, select index (check and unique are also supported).
5. Click on the Column tab.
6. Select the required columns from the Columns drop-down list in the required order, then click on the Save button to save changes.

Using the intermediary language I can set it up till point 4, by adding the following Operation to DDL.Class:
Code: [Select]
Table
{
  %TRANSFORM_REFERENCE("Table")%
  %TRANSFORM_CURRENT("language", "stereotype")%
  language=%qt%%genOptDefaultDatabase%%qt%
%list="Attribute" @separator="\n" @indent="  "%
%if elemType != "Association"%
  PrimaryKey
  {
    Column
    {
      name=%qt%%CONVERT_NAME(className, "Pascal Case","Camel Case")%Id%qt%
      type=%qt%%CONVERT_TYPE(genOptDefaultDatabase,"guid")%%qt%
    }      
  }
  [b]Operation
  {        
        name=%qt%IDX_%CONVERT_NAME(className, "Pascal Case","Camel Case")%Id%qt%
        stereotype=%qt%index%qt%
  }[/b]        
}
%endIf%
}

This works pretty good till this point, it creates an operation with the usual IDX_ index syntax.
But to get it completed I must assign a column now, like described in point 6. But I find no property for operations to asign a column now with the intermediary language.

Unfortunately the following doesn't work:
Code: [Select]
column=%qt%%CONVERT_NAME(className, "Pascal Case","Camel Case")%Id%qt%

Is there any other way to assign a column to an operation?

« Last Edit: April 07, 2010, 09:16:11 pm by pocketom »

FritzTheCat

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: MDA - assign columns to operations ?
« Reply #1 on: April 23, 2010, 02:20:59 am »
Try this, not that I am an expert, but I have seen that before.

Greetings

Operation
 {        
        name=%qt%IDX_%CONVERT_NAME(className, "Pascal Case","Camel Case")%Id%qt%
        stereotype=%qt%index%qt%
Parameter
  {
    name="Column1"
    type="Text"
  }

 }

FritzTheCat

  • EA Novice
  • *
  • Posts: 18
  • Karma: +0/-0
    • View Profile
Re: MDA - assign columns to operations ?
« Reply #2 on: May 04, 2010, 09:49:08 pm »
The parameter element does the trick :)

pocketom

  • EA User
  • **
  • Posts: 97
  • Karma: +0/-0
    • View Profile
Re: MDA - assign columns to operations ?
« Reply #3 on: February 11, 2011, 11:34:18 pm »
Right, the Parameter is doing well! What I'm not sure about is how to use it genrically? In the example above name="Column1" defines the Column tab you can see when manually adding an index. But what if I want to access now e.g. the tab 'Pre' or 'Post'? Would it be name = "Pre1" ? Searching the help files for "Parameter" returns everything but nothing about that...