Here’s how to use groupi() function.
Description:
Generate a sequence for use in a data-input sheet.
Syntax:
A.groupi(Di,…)
Note:
The function generate a sequence for use in a data-input sheet whose dimension is parameter Di. The values of column Di is A.group(D1).(~.group(D2).(…(~.id(Di))).
Options:
@o |
Assume that the sequence is ordered, perform a merge by comparing each record with its next neighbor and won’t sort the result set |
Parameters:
A |
A sequence |
Di |
A data-input sheet’s dimension |
Return value:
A sequence
Example:
|
A |
|
1 |
=demo.query("select * from employee") |
Return a table sequence |
2 |
=A1.groupi(GENDER,STATE,DEPT,NAME) |
Group data in columns GENDER,STATE and DEPT and perform distinct over column NAME |
3 |
=demo.query("select * from employee order by GENDER,STATE,DEPT") |
Return a table sequence and sort it by GENDER,STATE and DEPT |
4 |
=A3.groupi@o(GENDER,STATE,DEPT,NAME) |
Since A3’s table sequence is already ordered, perform a merge by comparing neighboring records; this gets the same result as A2’s but is faster |