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

Specify the source vector
elementVar
The reference to the variable, through which each source element is passed to elementsQuery subquery.

The variable reference must be produced using '@' operator (see example below).

elementsQuery
Specify the subquery that returns one or multiple elements to be added to the new vector.

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.

Returns:
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.

See Also:
FlexQuery()
Example:

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))
);
This will return the following vector:
{ 0, 1, 7, 10 }