5.2. Creating the traffic violations DMN custom data types
DMN data types determine the structure of the data that you use within a table, column, or field in a DMN boxed expression for defining decision logic. You can use default DMN data types (such as string, number, or boolean) or you can create custom data types to specify additional fields and constraints that you want to implement for the boxed expression values. Use the DMN designer’s Data Types tab in Business Central to define the custom data types for the traffic violations project.
図5.4 The custom data types tab
The following tables list the tDriver, tViolation, and tFine custom data types that you will create for this project.
| Name | Type |
|---|---|
| tDriver | Structure |
| Name | string |
| Age | number |
| State | string |
| City | string |
| Points | number |
| Name | Type |
|---|---|
| tViolation | Structure |
| Code | string |
| Date | date |
| Type | string |
| Speed Limit | number |
| Actual Speed | number |
| Name | Type |
|---|---|
| tFine | Structure |
| Amount | number |
| Points | number |
Prerequisites
- You created the traffic violations DMN decision requirements diagram (DRDs) in Business Central.
Procedure
-
To create the
tDrivercustom data type, click Add a custom Data Type on the Data Types tab, entertDriverin the Name field, and selectStructurefrom the Type list. Click the check mark to the right of the new data type to save your changes.
図5.5 The tDriver custom data type
Add each of the following nested data types to the
tDriverstructured data type by clicking the plus sign next totDriverfor each new nested data type. Click the check mark to the right of each new data type to save your changes.-
Name(string) -
Age(number) -
State(string) -
City(string) -
Points(number)
-
-
To create the
tViolationcustom data type, click New Data Type, entertViolationin the Name field, and selectStructurefrom the Type list. Click the check mark to the right of the new data type to save your changes.
図5.6 The tViolation custom data type
Add each of the following nested data types to the
tViolationstructured data type by clicking the plus sign next totViolationfor each new nested data type. Click the check mark to the right of each new data type to save your changes.-
Code(string) -
Date(date) -
Type(string) -
Speed Limit(number) -
Actual Speed(number)
-
To add the following constraints to the
Typenested data type, click the edit icon, click Add Constraints, and select Enumeration from the Select constraint type drop-down menu.-
speed -
parking -
driving under the influence
-
- Click OK, then click the check mark to the right of the Type data type to save your changes.
To create the
tFinecustom data type, click New Data Type, entertFinein the Name field, selectStructurefrom the Type list, and click Save.図5.7 The tFine custom data type
Add each of the following nested data types to the
tFinestructured data type by clicking the plus sign next totFinefor each new nested data type. Click the check mark to the right of each new data type to save your changes.-
Amount(number) -
Points(number)
-
- Click Save.