select. Selecting entries

^table.select(selection_criterion)
^table.select(selection_criterion)[options]
   [3.4.1]

The method looks through the table row by row, examining each row in respect to the specified
criterion (a mathematical expression). The rows which satisfy the criterion (returned Boolean value is "true") are collected into the table with the same structure as that of the original table.

Options hash can be specified:

$.offset(number of rows)
Skip specified number of rows which satisfy the criterion before copying the fist row.
$.limit(maximum)
Maximum number of rows to be selected
$.reverse(false/true)
true=process rows in the reverse order


Example
$men[^table::create{name   age
Stephen   26
Alex   20
Michael   29
Denis   30
}]
$thoseAbove20[^men.select($men.
age > 20)[ $.limit(2) ]]

Variable
$thoseAbove20 will contain table made up of rows with Stephen and Michael.


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