cs.groupn(x;C)

Read(761) Label: cursor records, group, channel,

Description:

Group records in a cursor and push them respectively into a sequence of channels.

Syntax:

cs.groupn(x;C)

Note:

The function groups records in cursor cs by grouping expression x, pushes them respectively into a sequence of channels, and returns the original cursor.

Parameter:

cs

Cursor records

x

Grouping expression

C

A sequence of channels

Return value:

Cursor

Example:

 

A

 

1

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

 

2

=channel()

Create a channel.

3

=channel()

Create a channel.

4

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

Group cursor records, and push one group where GENDER is F into A2’s channel and the other group into A3’s channel.

5

=A2.fetch()

Keep data in the channel in place.

6

=A3.fetch()

Keep data in the channel in place.

7

=A1.fetch()

 

8

=A2.result()

Get result from A2’s channel.

9

=A3.result()

Get result from A3’s channel.