Userdefined Data type: UDT¶
The data that cannot be converted to Adept2 data types (INTEGER, FLOAT, STRING, BOOLEAN, DATE, URI) can be declared as user-defined types (UDT) as follows. When creating the data element, select the data type USERDEFINED and then enter the UDT name.
There are different default UDT names which are already predefined in our system, e.g. Data Context, LocalisationData, container, subtable, File and List, for more Details see aristaflow-javadoc-all/de/aristaflow/adept2/model/globals/SystemDataConstants.html. You should specify the file parameters as UDT and use the UDT name File. For JSON Objects, enter application/json as the UDT name, as in Survey Data parameter. Of course, the userdefined data types can be named anything, excluding the names already used by our system. The values of these parameters or data elements can be read and further processed as an InputStream (UDTValue.getValueAsStream())or as an array of bytes (UDTValue.getValueAsArray()). In the following, the value of the parameter UdtValue with the type myType is read into another parameter data of type string. Both options are used as a byte array and InputStream.
The UDT lists are marked with the udt name List
For userdefined nested lists, the following syntax must be followed when entering the data type List<USERDEFINED,List<TYPE>>. The TYPE can be a simple ADEPT2 data type or, again, a userdefined type to allow nesting of userdefined lists.
Userdefined Values in Groovy Script¶
Entering a File Udt or Json file can be done as follows in the groovy script.
The elements of a Udt list or a Udt list of lists can be manipulated using Groovy scripts as follows.
The value of a string type parameter can be added to a string list and multiple string lists can be combined into a userdefined list. A list is displayed with square brackets in groovy script above. The result of the test execution in Scripting activity looks like this.
At the end, the userdefined list contains two string lists including the value of the string parameter data.