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

1 array.getElementAt

<array.getElementAt
    name='name'
    position='position'
>
    <array /> ?
</array.getElementAt>
Example

Get the first element of an array using a number as un index. In this example, the array will be referred to as an attribute.

Copy
<xsql-script name='array_getElementAt_test1'>
    <body>
        <array name='cities'>
            <string>Barcelona</string>
            <string>Paris</string>
            <string>Roma</string>
        </array>
        <println><array.getElementAt name='cities' position='0' /></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 second element of the array using a variable as an index.

Copy
<xsql-script name='array_getElementAt_test2'>
   <body>
       <array name='cities'>
           <string>Barcelona</string>
           <string>Paris</string>
           <string>Roma</string>
       </array>
       <println>
           <array.getElementAt position='1'>
               <cities/>
           </array.getElementAt>
       </println>
   </body>

</xsql-script>

In this case, the array will be called as an argument.

The result is:

Copy
Paris