Set the value that contains the array in the indicated position.
1 array.set
<array.set name='name'>
<array /> ?
<row /> !
<value /> !
</array.set>
Attributes | |||||
---|---|---|---|---|---|
Name | Type | Required | Default | Description | |
Aname | string | Name of the variable of array type. |
Arguments | |||||
---|---|---|---|---|---|
Name | Type | Required | Unique | Nullable | Description |
Earray | array | The array object can be referenced by name using the attribute name or it can be passed as an argument of the function. | |||
Erow | integer | Position of the object in the array. The first index is 0 and the last index is the lenght -1 (array.size - 1). | |||
Evalue | object | value to be saved into the indicated position. |
Returns | |
---|---|
Type | Description |
Object | Returns the passed object as an argument converted to an array. |
Example
Change the first element of an array using the number as an index.
Copy
<xsql-script name='array_test1'> <body> <set name='m_cities'> <array> <string>London</string> <string>Barcelona</string> <string>Paris</string> </array> </set> <array.set> <m_cities/> <number>0</number> <string>Rome</string> </array.set> <println><m_cities/></println> </body> </xsql-script>
The result is:
Copy
[Rome,Barcelona,Paris]