push()

Read(2422) Label: push,

Here’s how to use push() functions.

ch.push()

Description:

Push data in a channel into another channel.

Syntax:

ch.push(chi ,…)

Note:

The function pushes data in channel ch into channel chi, and returns channel ch itself.

Parameter:

ch

Channel

chi

Channel

Return value:

Channel

Example:

 

A

 

1

=demo.cursor("select * from SALES")

Create a channel.

2

=channel()

Create a channel.

3

=channel()

Create a channel.

4

=A2.select(ORDERID>100)

Attach ch.select() operation to A2’s channel.

5

=A1.push(A2)

Push data in A1’s cursor into A2’s channel.

6

=A2.push(A3)

A3 Push data in A2’s channel into A3’s channel.

7

=A2.fetch()

Attach ch.fetch() function that gets the final result set to A2’s channel to fetch and store the existing data.

8

=A3.groups(SELLERID:SellerId;sum(AMOUNT):Total)

Attach ch.groups() operation to A3’s channel.

9

=A1.fetch()

 

Data in A1’s cursor is actually pushed into the channel as the operation begins.

10

=A2.result()

 

Get results from A2’s channel.

11

=A3.result()

Get results from A3’s channel.

Related function:

cs.push()

channel()

cs.push()

Description:

Push data in a cursor into a channel.

Syntax:

cs.push(chi ,…)

Note:

The function pushes data in cursor cs into channel chi, but the action needs to wait until the data in the cursor is fetched; then returns the cursor itself. The function supports multicursors.

Parameter:

cs

Cursor

chi

Channel

Return value:

Cursor

Example:

 

A

 

1

=demo.cursor("select * from SALES")

Create a cursor.

2

=channel()

Create a channel.

3

=A2.select(ORDERID>100)

Attach ch.select() operation to the channel.

4

=A2.fetch()

Keep data in the channel.

5

=A1.push(A2)

Be ready to push A1’s cursor data to the channel.

6

=A1.fetch()

Fetch data from A1 cursor when the cursor data is really pushed into the channel and the operations in the channel are executed.

7

=A2.result()

Fetch the final result set from the channel.

Related function:

ch.push()

channel()