ch.groupn( x;C )

Read(698) Label: channel, group,

Description:

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

Syntax:

ch.groupn(x;C)

Note:

The function groups records in channel ch by grouping expression x and pushes them respectively into a sequence of channels.

Parameter:

ch

Channel

x

Grouping expression

C

A sequence of channels

Return value:

A channel

Example:

 

A

 

1

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

 

2

=channel(A1)

Push cursor records into a sequence of channels and return a channel.

3

=channel()

Create a channel.

4

=channel()

Create a channel.

5

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

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

6

=A3.fetch()

Attach ch.fetch() function that gets the final result set to A3’s channel but keep data in A3’s channel in place

7

=A4.fetch()

Attach ch.fetch() function that gets the final result set to A4’s channel but keep data in A4’s channel in place.

8

=A1.fetch()

 

9

=A3.result()

Get result from A3’s channel.

10

=A4.result()

Get result from A4’s channel.