cs.groupn(x;F)

Read(612) Label: cursor, group, bin file,

Description:

Attach the grouping record action to a cursor and return the original cursor while writing the grouped subsets to a sequence of bin files.

Syntax:

cs.groupn(x;F)

Note:

The function attaches a computation, which groups records of cursor cs by grouping expression x and writes the grouped subsets to sequence of bin files F, and returns the original cursor cs.

 

This is a delayed function.

Parameter:

cs

A cursor

x

Grouping expression

F

A sequence of bin file objects

Return value:

Cursor

Example:

 

A

 

1

=demo.cursor("select NAME,GENDER,DEPT,BIRTHDAY from EMPLOYEE")

Return a cursor.

2

=[file("f_dept.btx"),file("m_dept.btx")]

A sequence of bin file objects.

3

=A1.groupn(if(GENDER=="F",1,2);A2)

Attach a computation to cursor A1, which puts records where GENDER is F into the first group and the other records into the second group and writes the grouped subsets into a sequence of bin files in order, and return the original cursor.

4

=A3.skip()

Data will be really written to a bin file after the data fetching operation is really executed on cursor A1.