r_maplst(C;S;X)

Returns a list for each row in a table, in the order the columns appear in the table. (Available as of version 15.21)

Function type

Vector only

Syntax

r_maplst(C;S;X)

Input

Argument Type Description
C any A space- or comma-separated list of column names

C may also be a string expression (in single quotes) constituting a pattern for matching columns. For instance, 'foo*' specifies all columns that begin with "foo".

If C is omitted, the values in all of the columns are included.

Note: The columns specified by C must be either all numeric (integer and decimal) or all text.
S integer A boolean column or an expression in rcv_/rcn_/rct_ which determines whether or not that column is selected to be included in the calculation. See System variables for more information about rcv_/rcn_/rct_.

If S is omitted, all columns will be considered by the function (subject to any prior column selections).

X any A column name
X is an expression that is used to transform the value or name of each of the selected columns.
Note: Use the system variables rcv_, rcn_, and rct_ to reference the column value, name, and type, respectively.

Return Value

For each row of the table, r_maplst(C;S;X) returns a list of the values of the columns specified in C. The values can then be transformed by X, an expression in rcv_/rcn_/rct_. If X is omitted, then the values are simply the values of each column (or rcv_, the default). For example, r_maplst(;;) yields a list for each row of table data, containing the values of each column at each row.

Example

The following code finds the columns names beginning with the letter 'd' in the table pub.demo.retail.prod, selects only those columns that contain string data, converts the values contained within the columns to upper case, and displays the resulting values as a list:

<base table="pub.demo.retail.prod"/>
<willbe name="list" value="r_maplst('d*';rct_='a';strupcase(rcv_))"/>
<colord cols="list"/>

The C argument, 'd*', tells r_maplst to select only those column names starting with 'd'. The S argument, rct_='a', tells r_maplst to select only columns of type string. The only columns beginning with 'd' and containing string data are deptdesc and divdesc. The expression in X,strupcase(rcv_), tells r_maplst to convert the values in each column to upper case. Finally, the values contained within deptdesc and divdesc are displayed as a list, in the order in which they appear in the table.