Converts the specified vector into another vector, in which some of the source elements may be passed unchanged or replaced with new elements produced from the corresponding old ones.
The ordering of elements in the result vector will correspond to the original one.
Parameters:
v
elementVar
elementsQuery
subquery.
The variable reference must be produced using '@'
operator
(see example below).
elementsQuery
The subquery should be prepared using FlexQuery()
function
(see example below).
It will be executed for each element from the source vector.
The element is received in the subquery via the variable, whose reference
must be specified in the elementVar
parameter.
Any result returned by the subquery except enumeration will be added to the result vector.
This also applies to null
.
When the subquery returns an enumeration, all its elements will be added to the result vector.
When the original vector was null
, null
is returned.
When elementsQuery
parameter is null
, the original vector is returned.
Otherwise, the returned is always a new vector.
FlexQuery()
The following expression converts a string with comma-separated list of numbers into a vector of those numbers.
str_list = "0, 1, 7, 10";
convertVector (
breakString (str_list, ","),
@(String) s,
FlexQuery (toInt (s))
);
{ 0, 1, 7, 10 }