Description:
Get values of a specified field of a sequence.
Syntax:
A.field(F)
Note:
The function loops through parameter A to get the value of the Fth field from each record, or the value of every string parameter F, and returns a sequence consisting of these values. Count backward if F<0. Return null if F exceeds the boundary number of the fields or it does not exist.
Parameter:
A |
A sequence |
F |
The sequence number of a field, or the string parameter in which a variable can be used to reference the field name |
Option:
@r |
When the return value is a record or record sequence, loop its members iteratively to get desired values |
Return value:
Sequence
Example:
|
A |
|
1 |
=demo.query("select * from EMPLOYEE") |
|
2 |
=A1.field(2) |
Return a sequence composed of values of the second field. |
3 |
=A1.field(-2) |
Return a sequence comprising values of the second-to-last field. |
4 |
=A1.field("NAME") |
Return a sequence composed of values of NAME field. |
5 |
>arg1="NAME" |
|
6 |
=A1.field(arg1) |
Same as A4. |
7 |
=demo.query("select * from EMPLOYEE where EID < 20") |
|
8 |
=A7.group(STATE;~.avg(SALARY):avg,~:group) |
|
9 |
=A8.field@r(3) |
After A8’s 3rd column is returned, go on to return the 3rd column of the return value.
|
Related function: