Description:
Generate a sequence consisting of values of fields in a given cursor.
Syntax:
cs.id(xi,…;n)
Note:
The function generates a sequence of sequences, each of which is made up of values of xi field in cursor cs. Get at most n values for each xi field; return a sequence when there is only one xi field.
Parameter:
cs |
A cursor |
xi |
An expression; use comma to separate multiple expressions |
n |
An integer; return all values when omitted |
Option:
@o |
Do not sort data while removing neighboring duplicate members; require that data is ordered by expression x |
@u |
Do not sort result set by expression x; the option and @o are mutually exclusive |
@h |
Used to segment ordered data, which increases efficiency |
@0 |
Discard members on which expression x is computed and gets empty result |
@n |
Judge whether a member is distinct or not according to position when there is only one xi and xi is a natural number |
@b |
Judge whether a member is distinct or not according to the bit length in a byte in order to reduce storage usage when there is only one xi and xi is a natural number |
Return value:
Sequence
Example:
|
A |
|
1 |
=demo.cursor("select * from EMPLOYEE" ) |
|
2 |
=A1.id(#1,DEPT;5) |
|
3 |
=demo.cursor("select * from EMPLOYEE" ) |
|
4 |
=A3.id(DEPT;5) |
|
5 |
=demo.cursor("select * from EMPLOYEE" ).sortx(DEPT).id@o(DEPT) |
Do not sort records, but remove the neighboring duplicate records only.
|
6 |
=demo.cursor("select * from EMPLOYEE" ).id@u(DEPT) |
Do not sort result set by DEPT.
|
|
A |
|
1 |
=demo.cursor("select * from DEPT") |
Below is content of DEPT table:
|
2 |
=A1.id(FATHER) |
Return value: [null,1,2,11,12] . |
3 |
=A1.reset() |
|
4 |
=A1.id@0(FATHER) |
Return value: [1,2,11,12] . |