This article shows how to manage Complex Attributes with Complex Type in a Semarchy xDM model. Complex Attributes are useful to manage multi-attributes information like Addresses or Legal Information, that you need to use for multiple entities in your model.
It allows you to save design time and to keep a clear view of your business model by avoiding too many attributes on entities. It's also useful when you use Enrichers to keep both original and enriched values into your model or to store multiple outputs of Enrichers.
Note: If you have not configured any model and application yet, you can refer to Create a data model, Create entities and attributes articles for more details. |
Create Complex Type
Before adding a Complex Attribute to your model, you need to define a Complex Type.
Open your model in the Application Builder and follow these steps:
- Right-click on the Complex Type node in your model tree view and select Add Complex Type
- In the Create New Complex Type dialog, enter the Name of your Complex Type. Refer to Naming Conventions for more details.
- Review / Edit / Correct the Label.
- Click on Definition Attributes to access to Complex Type attributes list
- Click on Add Definition Attribute
- In the Create New Definition Attribute dialog, enter the Name of your attribute. Refer to Naming Conventions for more details.
- Review / Edit / Correct the Label and Physical Column Name.
- Select a Type from the available types (including LOV) and optionally set the physical database column Length, Precision and Scale when necessary.
- Specify if the attribute is mandatory or not using the checkbox and click on OK
- Repeat these steps to add more attributes until the Complex Type is complete
- Don't forget to save your Complex Type before using it on Entities
Now that your Complex Type is defined, you can use it to set up Complex Attributes.
Add Complex Attributes
Open your model in the Application Builder and follow these steps:
- Expand the Diagrams node and double-click on your main diagram.
- Select the target Entity to add the Complex Attribute, right-click on it, and select Add Complex Attribute
- In the Create New Complexe Attribute dialog, enter the Name of your attribute. Refer to Naming Conventions for more details.
- Review / Edit / Correct the Label
- Specify the Physical Prefix of your attribute.
Note: When you use several times the same Complex Type for the same entity, the Physical Prefix is convenient to identify columns related to each Complex Attribute in the physical data model. For example :
|
- Select the Complex Type from the available complex types
- Note that you can choose Mandatory or LOV Validation Scopes for Complex Attributes only when the Complex Type uses Mandatory or LOV attributes.
- Click on Finish. Your Complex Attribute is now available under your entity as a single attribute with a specific orange icon