Convert an object to an array.
1 array.fromArray
<array.fromArray name='name'>
<Object /> +
</array.fromArray>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | Name of the variable of resulting array type. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
EObject | object | Object that will be converted to array. |
Returns | |
---|---|
Type | Description |
Array | Returns the passed object as an argument converted to an array. |
Example
Converts an object of array type to another array.
Copy
<xsql-script name='test_array_fromArray'> <body> <println> <string>Array a</string> <array.toResultSet> <array.fromArray name='cities'> <array> <string>Barcelona</string> <string>Madrid</string> <string>Valencia</string> </array> </array.fromArray> </array.toResultSet> <string>Array b</string> <array.toResultSet> <array.fromArray name='cities'> <array> <string>[Barcelona, Madrid, Valencia]</string> </array> </array.fromArray> </array.toResultSet> </println> </body> </xsql-script>
Show the following result:
Copy
Array a +---------+ |col1 | +---------+ |Barcelona| |Madrid | |Valencia | +---------+ Array b +-----------------------------+ |col1 | +-----------------------------+ |[Barcelona, Madrid, Valencia]| +-----------------------------+
Example
Another example showing the differences:
Copy
<xsql-script name='test1_array_fromArray'> <body> <array name ='cities'> <string>Barcelona</string> <string>Madrid</string> <string>Valencia</string> </array> <println> <string>Array a</string> <cities /> <string>Array b</string> <array.fromArray> <cities /> </array.fromArray> </println> </body> </xsql-script>
Shows the result:
Copy
Array a [Barcelona,Madrid,Valencia] Array b [[Barcelona,Madrid,Valencia]]