Products Downloads


French version


 

 

Option to produce a fake data model used in place of the data model in the template development phase (JSON Object type).

 

Use

 

Using this option avoids calling the VaToolBxAPEAddInDataModel function to create a data model.

 

During the template development phase, it is not always possible to have a data model with values which correspond to real live data. This option enables fake data values to be produced. The values are produced randomly according to their type (each time the VaToolBxAPEMergeDoc function is called, new values are automatically produced). To do this, the user must describe the data model structure as it is in production, namely:

  • The model's tree structure: nesting (at several possible levels) of sub-variables,
  • For each sub-variable: its type (simple or complex). According to each type, a set of characteristics enabling the process to simulate the values.

The jsonGenerator option is described in JSON and has a JSON schema as a value. A JSON schema is a JSON object detailing the structure of certain JSON data (click here for more details).
Initially, a JSON schema is used to validate the structure of an item of JSON data before it is processed: it can be seen as the XSD counterpart (XML Schema Definition) for the XML.

 

In this case, the JSON schema is used to produce an item of JSON data validating the schema. The process uses version 4 of the JSON Schema specification.

 

General structure of a JSON v4 schema

General structure of a JSON v4 schema

A JSON schema is a JSON object containing the following attributes:

  • "$schema": indicates the version of the specification used to describe the schema,
  • "title": associates a title with the schema (optional),
  • "description": associates a description with the schema (optional),
  • "type": defines the type of JSON data to produce: the value must be "object" because this JSON data must represent the data model which is a hash table (and can therefore be represented by a JSON object),
  • "properties": for JSON "object"-type data to produce, this attribute (JSON "object" type) contains the description of attributes making up the JSON "object" data. The "properties" object contains the "sub-variables" name attributes; each attribute has an object containing the description of each "sub-variable" as a value.

 

Example: Simulate a data model containing three keys: "name" (ALPHA), "age" (NUM_BIN_2) and "isMarried" (BOOL)

Adelia 4GL in production

NUM_BIN_2 retCode
ALPHA(30) name
NUM_BIN_2 age
BOOL isMarried

name = 'Mary Smith'
age = 18
isMarried = *TRUE
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'name' name 'alpha' codeRet
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'age' age 'num_bin_2' retCode
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'isMarried' isMarried 'bool' retCode

Live data model

"Options" parameter

Example of fake data models produced

 

 

↑ Top of page

Simple-type data description

 

Here we explain how to describe a simple-type "sub-variable" in a fake data model.

Each "sub-variable" is described in the "properties" attribute.

A "sub-variable" must be described as follows:

  • Its name appears as an attribute name in the JSON "properties" object,
  • This newly created attribute has another JSON object whose "type" attribute is associated with the simple type as a value,
  • For certain Adelia types, the "adel_type" attribute must be specified to characterize the type.

↑ Top of page

Describe an item of Adelia BOOL-type foobar data

"Options" parameter

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
BOOL foobar

foobar = *TRUE
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'bool' retCode

Example of fake data models produced


The "true" Boolean value equals the *TRUE value (false equals *FALSE).

↑ Top of page

 

Describe an item of NUM_BIN_2-type foobar data

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
NUM_BIN_2 foobar

foobar = -1256
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'num_bin_2' retCode

 

Example of fake data models produced

The foobar values are between -32768 and 32767.

↑ Top of page

 

Describe an item of NUM_BIN_4-type foobar data

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
NUM_BIN_4 foobar

foobar = 45852632
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'num_bin_4' retCode

 

Example of fake data models produced

The foobar values are between -2147483648 and 2147483647.

↑ Top of page

 

 

Describe an item of NUM_BIN_8-type foobar data

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
NUM_BIN_8 foobar

foobar = 45852632
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'num_bin_8' retCode

 

Example of fake data models produced

The foobar values are between -9223372036854775808 and 9223372036854775807.

↑ Top of page

 

Describe an item of NUM_E/NUM_P-type foobar data

The "type" attribute value depends on the number of Adelia-type decimals:

  • If the decimals are 0, set "type" to "integer",
  • If the decimals are different from 0, set "type" to "number".

 

When an item of data represents a date

When an item of Adelia NUM_E / NUM_P (6, 0) or NUM_E / NUM_P (8, 0) type data represents a date (YYMMDD or YYYYMMDD format), numeric date values can be produced using the "adel_format" attribute: this must take the "ymd" string as a value.

 

When an item of data represents a time

When an item of Adelia NUM_E / NUM_P (6, 0) type data represents a time in HHMMSS format, numeric time values can be produced using the "adel_format" attribute: this must take the "hms" string as a value.

"Options" parameter

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
NUM_E(4,2) foobar

foobar = 17.85
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'num_e' retCode

Example of fake data models produced

The foobar values are between -99.99 and 99.99.

↑ Top of page

 

Describe an item of ALPHA-type foobar data

The "adel_type" attribute is used to define the maximum length of the alphanumeric strings to produce. However, this length can be restricted to an interval defined by the "minLength" and "maxLength" attributes.

These attributes take numeric values (the "maxLength" value must not be higher than the ALPHA type length).

 

Regular expression

A regular expression can be defined which will be used as a code when producing the alphanumeric string. There are certain limitations on the supported regular expression syntaxes. The "pattern" attribute is used to enter a regular expression.

For example, to produce a string representing an American Express credit card number, the "3[47][0-9]{13}" string needs to be entered as a "pattern" attribute value.

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
ALPHA(5) foobar

foobar = 'great'
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'alpha' retCode

 

Example of fake data models produced

The string length is random and between 0 and the Adelia type length.

Each character is chosen randomly from the 65 (A) and 90 (Z) decimal code range and the 97 (a) and 122 (z) decimal code range

↑ Top of page

 

Describe an item of DATE-type foobar data

An alphanumeric or numeric object-type date value can be produced:

  • If the "type" attribute is "object", the date is a Date object,
  • If the "type" attribute is "string", the date is an alphanumeric string in ISO 8601 format (YYYY-MM-DD),
  • If the "type" attribute is "integer", the date is a numeric value which corresponds to a timestamp, i.e. a number corresponding to a duration (in milliseconds) from January 1, 1970 at 0 o'clock (UTC).

 

A date interval can be specified in which the date to produce will be randomly chosen via "adel_min" and "adel_max" attributes.

These two attributes must take an alphanumeric string in ISO 8601 format (YYYY-MM-DD). If they are not entered, the produced date is between *LOVAL and *HIVAL.

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
foobar DATE

foobar Time
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'date' retCode

 

Example of fake data models produced

The foobar values are between *LOVAL (0001-01-01) and *HIVAL (9999-12-31)

"Options" parameter

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
foobar DATE

foobar Time
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'date' retCode

 

Example of fake data models produced

The foobar values are between *LOVAL (-62135596800000) and *HIVAL (253402214400000)

↑ Top of page

 

Describe an item of TIME-type foobar data

An alphanumeric or numeric object-type time value can be produced:

  • If the "type" attribute is "object", the time is a Time object,
  • If the "type" attribute is "string", the time is an alphanumeric string in ISO 8601 format (HH:MM:SS),
  • If the "type" attribute is "integer", the date is a numeric value which corresponds to a timestamp, i.e. a number corresponding to a duration (in milliseconds) from January 1, 1970 at 0 o'clock (UTC).

 

A time interval can be specified in which the time to produce will be randomly chosen via "adel_min" and "adel_max" attributes. These two attributes must take an alphanumeric string in ISO 8601 format (HH:MM:SS). If they are not entered, the produced time is between *LOVAL and *HIVAL.

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
foobar TIME

foobar Time
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'time' retCode

 

Example of fake data models produced

The foobar values are between *LOVAL (01:01:01) and *HIVAL (23:59:59)

"Options" parameter

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
foobar TIME

foobar Time
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'time' retCode

 

Example of fake data models produced

The foobar values are between *LOVAL (-3600000) and *HIVAL (82799000)

↑ Top of page

 

Describe an item of TIMESTAMP-type foobar data

An alphanumeric or numeric object-type timestamp value can be produced:

  • If the "type" attribute is "object", the timestamp is a Timestamp object,
  • If the "type" attribute is "string", the timestamp is an alphanumeric string in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS),
  • If the "type" attribute is "integer", the timestamp is a numeric value corresponding to a duration (in milliseconds) from January 1, 1970 at 0 o'clock (UTC).

 

A timestamp interval can be specified in which the timestamp to produce will be randomly chosen via "adel_min" and "adel_max" attributes. These two attributes must take an alphanumeric string in ISO 8601 format (yyyy-MM-dd'T'HH:mm:ss.SSS). If they are not entered, the produced timestamp is between *LOVAL and *HIVAL.

"Options" parameter

 

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
foobar TIMESTAMP

foobar Time
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'timestamp' retCode

 

Example of fake data models produced

The foobar values are between *LOVAL (01-01-01T01:01:01.000) and *HIVAL (9999-31-12T23:59:59.999)

"Options" parameter

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
foobar TIMESTAMP

foobar Time
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'timestamp' retCode

 

Example of fake data models produced

The foobar values are between *LOVAL (-62135596800000) and *HIVAL (253402300799999)

↑ Top of page

 

Describe an item of IMAGE-type foobar data

An alphanumeric string or byte array-type image value can be produced:

  • If the "type" attribute is "string", the value produced represents the content of the Base64-encoded image,
  • If the "type" attribute is "array", the value produced is a byte array.

 

In both definitions, the image format to produce needs to be specified with the "adel_format" attribute, which is used to define parameters with the syntax key = value. Three image formats are supported by entering the "mimetype" key:

  • mimetype=image/jpeg: Image in JPEG format,
  • mimetype=image/png: Image in PNG format,
  • mimetype=image/gif: Image in GIF format.

 

The size (in pixels) of the image to produce can be specified by providing the image dimensions (width x height) as a "size" key value. For example, to indicate that an image in PNG format which is 100 pixels wide and 50 pixels high needs to be produced, enter the value "mimetype=image/png ;size=100x50" into the "adel_format" attribute.

 

If no size is specified, the width and height of the produced image are chosen randomly from the pixel intervals [100, 200].

"Options" parameter

Adelia 4GL to create an equivalent data model

NUM_BIN_2 retCode
IMAGE foobar

call_class 'vatoolbx.dll' 'VaToolBxFileToImage' 'c:/dot.png' foobar retCode

* the image is converted to a Base64-encoded string

call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'image' retCode

Example of fake data models produced

Result image:

The image has a randomly chosen background color as well as a text indicating its size (width x height)

↑ Top of page

 

Complex-type data description

He we explain how to describe a REF_CLASS, ARRAY or LIST-type "sub-variable" in a fake data model.

 

Describe an item of REF_CLASS-type foobar data

An Adelia REF_CLASS-type item of data can be described in JSON as a JSON object ("object" type). This object contains its own "properties" attribute to describe all the attributes (the "sub-variables") of the Adelia foobar class instance.

 

Example: Simulate an Adelia class with simple-type attributes

Adelia 4GL in production

Person CLASS:
{
ALPHA(15) name ;
ALPHA(15) lastName ;
NUM_BIN_2 age ;
} *attributes

 

NUM_BIN_2 retCode
REF_CLASS(Person) foobar
foobar = new Person()
foobar.setname('Mary')
foobar.setlastName('Smith')
foobar.setage(18)
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'class' retCode

"Options" parameter

Example of fake data models produced

 


Another example: Simulate an Adelia class with simple and complex-type attributes

Adelia 4GL in production

Address CLASS:
{
ALPHA(15) city ;
NUM_BIN_2 postalCode ; *attributes

Person CLASS:
{
ALPHA(15) name ;
ALPHA(15) lastName ;
NUM_BIN_2 age ;
REF_CLASS(Address) address;
} *attributes

 

NUM_BIN_2 retCode
REF_CLASS(Address) address
address = new Address()
address.setcity('Seyssinet Pariset')
address.setpostalCode(38170)

REF_CLASS(Person) foobar
foobar = new Person()
foobar.setaddress(address)
foobar.setname('Mary')
foobar.setlastName('Smith')
foobar.setage(18)
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'class' retCode

 

"Options" parameter

 

Example of fake data models produced

 

↑ Top of page

 

Describe an item of ARRAY-type foobar data

An Adelia ARRAY-type item of data can be described in JSON as a JSON array ("array" type).

The type of values contained in this array is described in the "items" attribute. A minimum and maximum length for the produced array can be defined using "minItems" and "maxItems" attributes. If these two attributes are not defined, the array will be a random size.

 

Example: Simulate a 1D array of simple-type values

Adelia 4GL in production

NUM_BIN_2 retCode
NUM_E(2,1) foobar(3)
foobar(1) = 0.5
foobar(2) = 1.2
foobar(3) = -8.6
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'num_e' retCode

"Options" parameter

Example of fake data models produced

 


Another example: Simulate a 2D array of simple-type values

Adelia 4GL in production

NUM_BIN_2 retCode
DATE foobar(2,4)
foobar(1, 1) = &ALPHA_DATE('*ISO';'1985-02-12')
?
call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'date' retCode

"Options" parameter

Example of fake data models produced

↑ Top of page

 

Describe an item of LIST-type foobar data

An Adelia LIST-type item of data can be described in JSON as a JSON array ("array" type) of JSON objects.

Each JSON object contains the values from one line of the list: each list column value is associated with a name attribute from the column (lowercase).

The "items" attribute must therefore describe a JSON object ("object" type).

It is also possible to define a minimum and maximum length for the list (array) produced array using "minItems" and "maxItems" attributes. If these two attributes are not defined, the list will be a random size.

 

Example: Simulate a list of simple-type values

Adelia 4GL in production

NUM_BIN_2 retCode
ALPHA(30) NAME
NUM_BIN_2 Age
LIST foobar NAME Age

NAME = 'Franck Hunter'
Age = 18
Insert_elt foobar
NAME = 'Theresa Black'
Age = 17
Insert_elt foobar
NAME = 'Alexander Faye'
Age = 19
Insert_elt foobar

call_class 'vatoolbx.dll' 'VaToolBxAPEAddInDataModel' 'myDataModel' 'foobar' foobar 'list' retCode

"Options" parameter

Example of fake data models produced

↑ Top of page


 

  • Aucune étiquette