Returns the value that the array contains in the indicated position.
 

1 array.get

<array.get name='name'>
    <array /> ?
    <row /> !
</array.get>
Example

Get the first element of an array using a number as an index.

Copy
<xsql-script name='array_get_test1'>
    <body>
        <array name='cities'>
            <string>Barcelona</string>
            <string>Paris</string>
            <string>Roma</string>
        </array>

        <println>
            <array.get name='cities'>
                <number>0</number>
            </array.get>
        </println>
    </body>
</xsql-script>

Reference is made to the first element of the collection, the string 'Barcelona', with the integer 0.

The result is:

Copy
Barcelona
Example

Get the third element of an array using a variable as an index.

Copy
<xsql-script name='array_get_test2'>
   <body>
       <array name='cities'>
           <string>Barcelona</string>
           <string>Paris</string>
           <string>Roma</string>
       </array>
       <set name='position'>2</set>
       <println>
           <array.get name='cities'>
               <position/>
           </array.get>
       </println>
   </body>

</xsql-script>

The index is contained into the variable position, which is declared and assigned previously.

The result is:

Copy
Roma