Powerd911 – Numéro #1 au Canada

À propos des préférences au niveau des éléments d’informations « Code unique » et « Réutilisation admise »

Lors de la génération d’un MCD à partir d’un MPD et que l’option « Réutilisation admise » est sélectionnée, les éléments de données sont créés dans le cadre du MCD en utilisant la fonctionnalité de réutilisation des éléments de données.
Situations :

No_info

CU

RA

CURA

Définition des options de modèle pour un MCD/MLD

Code unique

Requiert que chaque information ou relation soit dotée d’un code unique.

Note : La préférence « Code unique » ne peut pas être sélectionnée si deux informations ont déjà le même code.

 

Réutilisation admise

Permet de réutiliser une information comme attribut pour plusieurs entités à condition que les attributs aient le même nom et le même type de données et qu’ils n’appartiennent pas à une clé primaire.

L’information ne peut pas être réutilisée :

  • si la case « Réutilisation admise » est décochée;
  • si l’attribut appartient à une clé primaire.

Si la case « Réutilisation admise » est déchochée et :

  • si la case « Code unique » est cochée, une nouvelle information ayant le même nom mais un code différent est créée;
  • si la case « Code unique » est décoché, une nouvelle information ayant le même nom et le même code est créée.

Lorsque vous supprimez une entité ou des attributs d’une entité, les options relatives aux informations déterminent si les informations correspondantes sont également supprimées :

  • Si les options Réutilisation admise et Code unique sont cochées – Seulement l’attribut d’entité est supprimé.

  • Si seulement l’option Code unique est cochée– Seulement l’attribut d’entité est supprimé.

  • Si seulement l’option Réutilisation admise est cochée – L’attribut d’entité et l’information correspondante sont supprimés (si l’information n’est pas utilisée par une autre entité).

  • Si aucune des deux cases sont cochées – L’attribut d’entité et l’information correspondante sont supprimés.

Note :

  • Autoriser la réutilisation n’impose pas la réutilisation par le modélisateur ;
  • Cocher « Code unique » et « Réutilisation admise » permet au modélisateur d’éviter de renommer les élément de données.

Dans un modèle MCD vous ajoutez le script de transformation suivant dans un fichier d’extension .xem avec le profil Information

Sub %Transformation%(obj, trfm)
dim pData
dim pAttr
dim pModel : Set pModel = obj.Model

' On vérifie si l'option Réutilisation admise a été assignées
if (pModel.GetModelOptions().DataItemAllowReuse) then
for each pData in pModel.DataItems
if isTwinInfo(pData, obj) then
for each pAttr in obj.Attributes
Set pAttr.DataItem = pData
next
obj.Delete
exit for
end if
next
end if
End Sub

 

Option When selected When cleared
Unique code Each data item must have a unique code.

If you try to select this option and some existing data items are already sharing a code, the following error will be displayed:

Unique Code option could not be selected because two data items have the same code: data_item_code

To be able to select the option, you must first assign unique codes to all data items.

Multiple data items can have the same code, and you differentiate them by the entities that use them. The entities are listed in the Used By column of the list of data items.

Note:

To make an item visible in a list, click the Customize Columns and Filter tool in the list toolbar, select the appropriate check box from the list of filter options that is displayed, and click OK.

Allow reuse One data item can be an entity attribute for multiple entities. Each data item can be an entity attribute for only one entity
Function isTwinInfo(i1, i2)

if (i1 is i2) then
isTwinInfo = False
elseif (i1.Name <> i2.Name) then
isTwinInfo = False
elseif (i1.Code <> i2.Code) then
isTwinInfo = False
elseif (i1.Datatype <> i2.Datatype) then
isTwinInfo = False
else
isTwinInfo = True
end if
end function

Finalement ajouter dans le fichier .xem un profil de transformation, en incluant la transformation précédente au niveau du « post-generation »

Lors de la génération d’un modèle physique vers un modèle conceptuel, sélectionner  »Enable Transformation » et sélectionner la propriété appropriée.

This is a great way to enforce consistency throughout the data dictionary model.

if allowed to re-use a field need to be configured with the following data modeling powerdesigner

Tools -Model Options-DataItem (bottom right corner of the dialog box) to the front unique code and Allow reuse checkbox hook all removed, so that you can re-use a field in more than one table.

Note: If you check, then allow reuse, re-use multi-table a field, the value is the same name, and in some cases, this is very inconvenient, because in different fields in the table have different meanings.

Entity Attribute name uniqueness problem occurs:

Select – after « Tools> Model Options » « Allow reuse » check box is also proposed to remove the hook

Tool-> check model … removed under Entity Attribute

Entity Attribute name uniqueness and Entity Attribute code uniquenes

Copying Entities

You can make a copy of an entity within the same model or between models. When you copy an entity, you create a new entity with a new name and code, attributes, and identifiers. Model options control whether you create new data items or reuse the data items that are attached to the original entity.

  1. Select an entity in the CDM/LDM, and then select Edit > Copy (or press Ctrl+C).
  2. Select the diagram or model to where you want to copy the entity and select Edit > Paste (or press Ctrl+V).

    The entity is copied and the new entity is displayed in the Browser and diagram.

    Note: When copying an entity to the same model, a new entity with a new name and code, attributes, and identifiers is always created, but the creation of new data items is controlled by data item model options (see Setting CDM/LDM Model Options). Select:

    • Allow reuse – to attach the original data items to the new entity attributes. If this option is not selected, the original data items will be copied and these copies will be attached to the new entity attributes.
    • Unique code – to force all data items to have unique codes (though two or more data items can have the same name). If neither this option nor Allow reuse is selected, then duplicate data items will be created with the same names and codes.

Creating an Attribute

You can create an entity attribute from the Attributes tab in the property sheet of an entity, association, or inheritance.

You can use the following tools, available on the Attributes tab:

Tool Description

Add a Row – Creates a new attribute and associated data item.

If you have enabled the Allow Reuse model option (see Setting CDM/LDM Model Options), the new data item can be used as an attribute for other objects.

If you have enabled the Allow Reuse and Unique Code model options and you type the name of an existing data item, it will be automatically reused.


Add Data Item (CDM)/Add Attributes (LDM) – Opens a Selection window listing all the data items/attributes available in the model. Select one or more data items/attributes in the list and then click OK to make them attributes to the object.

If the data item/attribute has not yet been used, it will be linked to the object. If it has already been used, it will be copied (with a modified name if you have enabled the Unique code model option) and the copy attached to the object.

Reuse Data Item Reuse Data Item (CDM) – Opens a Selection window listing all the data items/attributes available in the model. Select one or more data items/attributes in the list and then click OK to make them attributes to the object.

Deleting Attributes (CDM)

When you delete an attribute, model options determine whether or not the corresponding data items are also deleted:

Model options selected Result of deleting an attribute
Unique Code and Allow Reuse Does not delete corresponding data item
Unique Code only Does not delete corresponding data item
Allow Reuse only Deletes corresponding data item if it is not used by another entity
None Deletes corresponding data item

Laisser un commentaire