Data Dictionary Worksheet
Data Dictionary is an AlchemyJ Component which defines the properties of data items used in a model. It can be used for validation checking and data transformation. The configuration worksheet of Data Dictionary consists of two parts, Data Items - For defining the rules of validation and transformation; Error Message Settings - to customize the error message when error occurs.
After you defined the Data Dictionary, you can use AlchemyJ Extended Function ajCheckDataItem to perform the validation and transformation in the backend. You also can use the AlchemyJ JavaScript Library Function to perform the validation in the frontend. Please refer to the below samples on how to use the Data Dictionary Worksheet.
Data Items
Basic properties of a data item.
Property | Description |
---|---|
Data Name | Field name |
Data Type | Big Number, Big String, Boolean, Date, Double, File, Integer, String |
Display Name | Field Name which will be used for display. It is used by ajCheckDataItem when it returns an error message. |
Required | Y- Mandatory, N - Optional |
Default Value | The value to be filled in if the input value is blank. |
Example Value | Example Value that will be used in OpenAPI specification and Testing Tool. |
Category | Customized column allow user to categorize the data items. |
Description | Description to be shown in the OpenAPI specification for this field. |
Field Error Message | Error message for this field. For any error raised for this data item, will show the defined message if it is not blank |
Properties of a Number data item.
Property | Description |
---|---|
Multiple Of | The input value should be a multiple of the defined value. The decimal number is also supported. For example, if set this item as 0.5, then the field would accept values such as -0.5, 0, 0.5, 1, 1.5 but not 0.1, 1.2. |
Maximum | The input value should be less than or equal to the defined value. |
Exclusive Maximum | The input value should be less than the defined value. |
Minimum | The input value should be greater than or equal to the defined value. |
Exclusive Minimum | The input value should be greater than the defined value. |
Number Value List | Possible numeric values of this data item. The default separator is '-||-'. It can be changed in the Application Configuration Worksheet. For example, 11-||-22-||-33 |
Rounding | Round, Round Up, or Round Down |
Rounding Number of Digits | Number for digits to be rounded. |
Properties of a String data item.
Property | Description |
---|---|
Max Length | Maximum number of characters. |
Min Length | Minimum number of characters. |
String Value List | Possible values of this data item. |
Pattern | The string pattern its value should follow. It is a regular expression. |
Format Type | Predefined format validation. It can be Email Address, JSON, File Path, URL, Hong Kong ID, China ID, Singapore NRIC. |
Case Conversion | Convert the case of the value to Lower, Upper, Upper First Letter. |
Properties of a Date data item.
Property | Description |
---|---|
Date Format | Date format it should use. It could be MM-dd-yyyy, MM/dd/yyyy, MMM-dd-yyyy, dd-MM-yyyy, dd-MMM-yyyy, dd/MM/yyyy, yyyy-MM-dd, yyyy-MMM-dd, yyyy/MM/dd |
Minimum Days | The input value is a number that indicates the number of days to be added/subtracted from today. For example, Minimum Days = -8 means the date cannot be earlier than today - 8 days. Minimum Days = 4 means the date cannot be earlier than today + 4 days. |
On and After | The input value should be the same as or later than the date defined in this field. |
Maximum Days | The input value is a number that indicates the number of days to be added/subtracted from today. For example, Maximum Days = -8 means the date cannot be later than today - 8 days. Maximum Days = 4 means the date cannot be later than today + 4 days. |
On and Before | The input value should be the same as or earlier than the date defined in this field. |
Allowed Days of Week | Which day of the week is allowed. 1 to 7 stands for Monday to Sunday. Leaving it blank means any day is allowed. Multiple values are allowed here, separated by a comma. |
Disallow Dates | The dates are not allowed. Dates must in "yyyy/mm/dd" format, separated by a comma. For example, "2019/3/20, 2020/1/28, 2020/10/1". |
Disallowed Dates Handling | This specifies how to calculate the disallowed date when Minimum Days or Maximum Days are defined. When any options are selected in this field and there are disallowed dates fall in the period defined by Maximum Days and Minimum Days, the period would be recalculated. If no option is selected, the period would not be recalculated. This configuration specifies how to recalculate. - Next allowed date, it uses the first allowed date as the period starting or ending after skipping those disallowed dates specified by Allowed Days of Week and specified by Disallow Dates. Example 1, Allowed Days of Week = "1,2,3,4,5", means Saturday and Sunday are disallowed. Minimum Days = -2. Today is Monday, The date value becomes must be on or after last Friday. Minimum Days = -2 means it must be today - 2 = Saturday but Saturday is not allowed. As we are going backward (negative) so, the next allowed date is Friday. Example 2, Allowed Days of Week = "1,2,3,4,5", means Saturday and Sunday are disallowed. Minimum Days = 2. Today is Friday. The date value becomes must be on or after next Monday. - Keep allowed duration, it uses the first allowed date as the period starting or ending after extending corresponding days, which depends on how many disallowed dates fall in the period. Example 1, Allowed Days of Week = "1,2,3,4,5", means Saturday and Sunday are disallowed. Minimum Days = -2. Today is Monday. The date value becomes must be on or after last Thursday. Monday - 2 = Saturday but there are two disallowed days in between, so we minus 2 again. Saturday - 2 = Thursday. Example 2, Allowed Days of Week = "1,2,3,4,5", means Saturday and Sunday are disallowed. Minimum Days = 2. Today is Friday. The date value must be on or after next Tuesday. Friday + 2 = Sunday but there are two disallowed dates (Sat and Sun) so we add 2 more days, therefore, it becomes Tuesday. |
Convert To | Transform the value to a string or a number according to the date format defined. |
Properties of a File data item.
Property | Description |
---|---|
Min File Size | Minimum file size check in MB. For example, 100 means 100MB, 1024 means 1GB. |
Max File Size | Maximum file size check in MB. |
File Name Pattern | Use regular expression to check whether the file name matches the defined pattern. |
Allowed File Extension | If this is not blank, only allow files with the defined file extension. It is case insensitive. Use comma as the separator. e.g. png, jpeg, docx |
Disallowed File Extension | Do not allow files with the defined extension. It is case insensitive. Use comma as the separator. e.g. png, jpeg, docx |
Magic Number Check | TRUE - means the check of the allowed file extension and disallowed file extension will also check the file magic number. If the file type indicated by the magic number of the file is not the same as the file extension, the validation will fail. False/empty - means do not check the magic number. **A magic number is a number embedded at or near the beginning of a file that indicates its file format (i.e., the type of file it is). It is also sometimes referred to as a file signature. |
Note: Please note that the JavaScript version of data dictionary does not support the file data type. Such data items will be omitted in the generated JavaScript file. Avoid using formulas on a data dictionary worksheet as they will not be supported.
Error Message Settings
The error message settings section defines the error message that will be returned by ajCheckDataItem. It can be changed as needed. It supports the following place holders:
[Data Name] - Replaced with the data name of the data item.
[Display Name] - Replaced with the display name of the data item if it exists. If the data item has no display name, the data name will be used instead.