Creating New Datatypes
Each datatype is implemented in the form of a class; it is specific to a DBMS version. It is possible to use masks with datatypes.
Creating Datatypes - Example for Oracle 10
Objective
In the ORACLE scripts, create a numeric datatype called Data8 with a length and a specified number of decimal places.
Steps
Steps are as follows:
1. Create a new datatype in HOPEX.
2. Connect the datatype to the target DBMS (in this case Oracle 10).
3. Connect the datatype to the corresponding type in the "Pivot" package.
4. Configure the conditions on each link in both directions (from datatype to pivot type and vice-versa).
*For more information on equivalence links and conditions, see Determining Column Datatypes from Attribute Types .
Prerequisite Conditions
To see packages containing DBMS datatypes, you must import the corresponding module. See Importing a DBMS Version.
*It is recommended that a datatype be defined in only one DBMS version.
To import the module of datatypes:
1. From your HOPEX version, open the HAS Console.
2. From the navigation menu, click Modules.
The HAS console displays:
installed modules
the store where you can download modules
modules to be updated
3. In the store, search for the module to install and download it.
In addition, certain data is protected in HOPEX. To be able to modify objects contained in DBMS packages:
1. Open the administration desktop with the HOPEX Administrator profile.
2. In the upper right-hand corner of the desktop, click on the menu associated with the administrator's account and then click Options.
3. In the options window, expand the Installation folder.
4. Click the Customization folder.
The list of options linked to customizing appears in the right pane of the window.
5. In the Authorize HOPEX data modification box, select "Authorize".
6. Click OK.
Creating a new datatype
To create a new datatype in HOPEX Data Governance:
1. Click the Architecture > Data Dictionaries navigation menu.
*In HOPEX Data Architecture, click the Data Architecture> Hierarchy View navigation menu.
2. Expand the Data Dictionaries folder.
3. Click the icon of the "Oracle 10" package and select New > Class.
The Creation of Class dialog box opens.
4. Name your class "Data8 (@L,@D)".
5. Open the properties dialog box of this new class.
6. In the Characteristics page, select “Expression” in the Stereotype field.
7. In the Type expression field which appears, a little lower, select the value “Data8 (@L,@D)”.
You can see in the navigator that a new class “Data 8” has been created.
*This new class is automatically created for UML operating requirements..
Connecting the datatype to the pivot type
If you wish to obtain this datatype after synchronization, you must give it an equivalence at the logical level.
1. Open the properties of datatype "DATA8 (@L,@D)".
2. Click the Complements page.
3. Right-click the "Conceptual Equivalence" folder and select Connect.
4. In the query dialog box, select the class "P-Numeric".
Configuring conditions on links
To configure a condition on links:
1. Right-click the "Data8" class and select Explorer.
2. Expand the "Conceptual Equivalence" folder.
3. Select the green folder "Programming Language Equivalence".
You will see that there are three other cases of correspondence for Oracle 10.
Conditions on these correspondences must therefore be modified so that they will be coherent with the conditions placed on the new datatype.
4. Right-click the “NUMBER(@L,@D)” datatype and select Properties.
5. In the Texts page, select "Language equivalence condition", and modify the text as follows:
Sub ConditionInvoke (Column, ByRef bValid)
bValid = False
Dim IsNumericLength
IsNumericLength = IsNumeric(Column.Length)
Dim IsNumericDecimal
IsNumericDecimal = IsNumeric(Column.Decimal)
If (IsNumericLength and IsNumericDecimal) Then
If (Column.Length <> 8) Then
bValid = True
End If
End If
End Sub
 
6. In the same way, add the following text in the properties dialog box of new datatype "Data8".
Sub ConditionInvoke (Column, ByRef bValid)
bValid = False
Dim IsNumericLength
IsNumericLength = IsNumeric(Column.Length)
Dim IsNumericDecimal
IsNumericDecimal = IsNumeric(Column.Decimal)
If (IsNumericLength and IsNumericDecimal) Then
If (Column.Length = 8) Then
bValid = True
End If
End If
End Sub
Verifying datatypes
To verify datatypes:
1. Display the properties of a column concerned by conditions placed on the datatype.
2. Verify that the mask displayed in the Datatype column is "Data8 (%l, %d)" for this column.
Creating Datatypes - Example for SQL Server 7
Objective
Reread SQL Server 7 columns containing a non-standard datatype.
Manipulations are the same as for Oracle (see Creating Datatypes - Example for Oracle 10). On this occasion we shall not create a mask.
Creating a new datatype
To create a new datatype in HOPEX Data Governance:
1. Click the Architecture > Hierarchy View navigation menu.
2. Unfold the Data Dictionaries folder.
3. Click the icon of the "Oracle 10" package and select New > Class.
The Creation of Class dialog box opens.
4. Name your class "TLongName".
5. Open the properties dialog box of this new class.
6. In the Characteristics page, select "Expression" in the Stereotype drop-down list, then click OK.
Connecting the datatype to the pivot type
To connect the datatype to the primitive type:
1. Open the properties of the "TLibelleLong" datatype.
2. Select the Complements page.
3. Right-click the "Conceptual Equivalence" folder and select Connect.
4. In the query dialog box, select the "P-Text" class.
Configuring conditions on links
To configure a condition on links:
1. Right-click the "TLibelleLong" class and select Explorer.
2. Select the green folder "Programming Language Equivalence".
You will see that there is another correspondence for SQL Server 7.
3. Open the properties dialog box of datatype "text".
4. In the Texts page, select "Language equivalence condition", and modify the text as follows:
Sub ConditionInvoke (Column, ByRef bValid)
bValid = False
Dim IsNumericLength
IsNumericLength = IsNumeric(Column.Length)
If (IsNumericLength) Then
If (Column.Length > 255) Then
bValid = True
End If
End If
End Sub
5. In the same way, add the following text in the properties dialog box of new datatype "TLongName".
Sub ConditionInvoke (Column, ByRef bValid)
bValid = False
Dim IsNumericLength
IsNumericLength = IsNumeric(Column.Length)
If (IsNumericLength) Then
If (Column.Length <= 255) Then
bValid = True
End If
End If
End Sub