array. Table to array conversion   [3.5.0]

^table.array[]
^table.array[column_name]
^table.array{code}

The method returns an array where each element corresponds to one row of the table. The passed parameter determines the value of the array element:
·when called without a parameter - a hash with column names as keys and the corresponding column values as values;  
·when called with a column name - a string with the value of the specified column;  
·when called with code - the result of executing the passed code.  

Example

^table.array[]
^table.array[
column1]
^table.array{
 $table.column1 + $table.column1 }

Will create the following arrays:

[  
  {"column1": "value1", "column2": "value2"},  
  {"column1": "value3", "column2": "value4"},  
  ...  
]  
[  
  "value1",  
  "value3",  
  ...  
]  
[  
  " value1 + value2 ",  
  " value3 + value4 ",  
  ...  
]



Copyright © 1997–2025 Art. Lebedev Studio | http://www.artlebedev.com Last updated: 03.01.2025