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, e.g. Data Context, LocalisationData, container, subtable, File and List, for more Details see aristaflow-javadoc-all/de/aristaflow/adept2/model/globals/SystemDataConstants.html. For example, for File type parameters, enter File or 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. 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>>.
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 result of the test execution in Scripting activity looks like this.