Description:
Evaluate the expression with each member in the cursor.
Syntax:
cs.(x) |
|
cs.() |
Retrun cs itself |
Note:
The function evaluates the expression using each member of the cursor and returns results as a cursor.
Parameters:
cs |
Cursor |
x |
An expression that is generally a single field name; or a legal expression composed of multiple field names. Both can use ~ to reference the current record. |
Return value:
A cursor consisting of values of expression x calculated from every member
Example:
|
A |
|
1 |
=connect("demo").cursor("select * from EMPLOYEE where EID<10") |
|
2 |
=A1.(age(BIRTHDAY)) |
Compute age according to A1’s BIRTHDAY field |
3 |
=A2.fetch() |
|
4 |
=connect("demo").cursor("select * from SCORES where SCORE<60") |
|
5 |
=A4.(SCORE) |
|
6 |
=A5.(~*~) |
Use ~ to reference the current sequence member |
7 |
=A6.fetch() |
|
8 |
=demo.cursor("select * from DEPARTMENT") |
|
9 |
=A8.() |
Return A8 |
10 |
=A9.fetch() |
|
Here’s how to use cuboid() function.
Description:
Store the result set of grouping an entity table or a multi-zone composite table as a pre-summarized data cube.
Syntax:
T.cuboid(C,Fi,…;y:Gi,…)
Note:
The function stores the result set of grouping entity table/multi-zone composite table T by grouping field Fi as a pre-summarized data cube C and writes the data cube locally. The Gi field is the result of calculating aggregate function y over each group.
Generate a pre-summarized data cube for each zone table when T is a multi-zone composite table.
Parameters:
T |
An entity table or multi-zone composite table |
C |
Pre-summarized data cube name; delete the pre-summarized cube with the specified name when only this parameter is present |
Fi |
Grouping field |
y |
Aggregate function, support only sum/count/max/min/top/iterate; when working with iterate(x,a;Gi,…) function, parameter Gi isn’t supported |
Gi |
Field name in result set |
Return value:
A composite table object
Example:
|
A |
|
1 |
=file("D://orders.ctx").open() |
Open composite table file orders.ctx:
|
2 |
=A1.cuboid(test,OCount;count(EID):COUNT) |
Group A1’s composite table by Ocount, count the number of EID in each group, store the resul set in the pre-summarized data cube test and save the data cube on D drive |
3 |
=A1.cuboid(test1,OCount;count(EID):COUNT,min(OAmount):MIN) |
Group A1’s composite table by Ocount, count the number of EID and find the minimum value of Oamount in each group, and store the resul set in the pre-summarized data cube test1
|
4 |
=A1.cuboid() |
Delete all pre-summarized cubes
|
5 |
=A1.cuboid(test) |
Delete data cube test
|
6 |
=file("emp.ctx":[2,3]) |
Open a file group |
7 |
=A6.open() |
Open a multi-zone composite table |
8 |
=A7.cuboid(cub_cp,GENDER;avg(SALARY):avg_SALARY) |
Group the data table corresponding to each zone table by GENDER, calculate average SALARY in each group, and store the result sets as pre-summarized data cube cub_cp. Below are the output files: |