Here’s how to use push() function.
Description:
Push data in a given sequence into a channel.
Syntax:
A.push(chi ,…)
Note:
The function pushes data in sequence A into channel chi and returns the sequence itself. Unless a function that gets the final result set is attached to the channel, the final result set can’t be retrieved from it as the sequence is pushed in.
Parameters:
A |
A sequence |
chi |
Channel |
Return value:
Sequence
Example:
|
A |
|
1 |
=demo.query("select * from SALES") |
|
2 |
=channel() |
Create a channel |
3 |
=channel() |
Create a channel |
4 |
=A2.groups(SELLERID:SellerId;sum(AMOUNT):Amount) |
Attach ch.groups() operation that gets the final result to A2’s channel |
5 |
=A3.select(ORDERID<10) |
A3 attaches ch.select() operation to A2’s channel |
6 |
=A3.fetch() |
Attach ch.fetch() function that gets the final result to A3’s channel to fetch and store the existing data |
7 |
=A1.push(A2,A3) |
Push data in A1’s sequence into A2’s channel and A3’s channel |
8 |
=A2.result() |
Get results from A2’s channel |
9 |
=A3.result() |
Get results from A3’s channel |
Related functions:
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.
Parameters:
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.groups(SELLERID:SellerId;sum(AMOUNT):Total) |
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 functions:
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.
Parameters:
cs |
Cursor |
chi |
Channel |
Return value:
Cursor
Example:
|
A |
|
1 |
=demo.cursor("select * from SALES") |
Create a cursor |
2 |
=channel() |
Create a channel |
3 |
=channel() |
Create a channel |
4 |
=A2.groups(SELLERID:SellerId;sum(AMOUNT):Total) |
Perform ch.groups() operation in the channel |
5 |
=A3.select(ORDERID<10) |
Attach ch.select() operation to A3’s channel |
6 |
=A3.fetch() |
Fetch and store the existing data in the channel |
7 |
=A1.push(A2,A3) |
Be ready to push data in A1’s cursor into the channel, but the action needs to wait |
8 |
=A1.groups(SELLERID:SellerId;sum(AMOUNT):Total) |
Data in A1’s cursor is pushed into the channel as the data retrieval operation begins |
9 |
=A2.result() |
Get results from A2’s channel |
10 |
=A3.result() |
Get results from A3’s channel |
|
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 functions: