ch.()

Description:

Attach a computation to a channel and return the orignal channel.

Syntax:

ch.(x)

 

ch.() 

Return the channel ch itself

Note:

The function attaches a computation to channel ch, which will compute expression x over each of its members, and returns the original channel.  

 

This is an attachment function.

Parameter:

ch

A channel

x

An expression, which is a field name generally or a legal expression consisting of field names; use ~ to reference the current record

Return value:

Channel

Example:

 

A

B

C

 

1

=demo.cursor("select EID,NAME,BIRTHDAY,SALARY from EMPLOYEE where EID<10")

 

 

 

2

=channel()

=channel()

=channel()

Create channels A2, B2 and C2.

3

=A2.(age(BIRTHDAY))

 

 

Attach a computation to channel A2, which will compute age(BIRTHDAY) on BIRTHDAY’s members, and return result to the channel.

4

=A2.fetch()

 

 

Execute result set function in channel A2 and keep the current data in channel.

5

=B2.(SALARY)

 

 

Attach a computation to channel B2, which will compute SALARY column, and return the original channel B2.

6

=B2.(~*1.2)

 

 

Attach a computation to channel B2, which will use ~ to reference the current member of the sequence to compute SALARY*1.2, and return the original channel B2.

7

=B2.fetch()

 

 

Execute result set function in channel B2 and keep the current data in channel.

8

=C2.()

 

 

Return channel C2.

9

=C2.fetch()

 

 

Execute result set function in channel C2 and keep the current data in channel.

10

=A1.push(A2,B2,C2)

 

 

Be ready to push data in A1’s cursor into channel A2, B2 and C2, but the action needs to wait.

11

=A1.fetch()

 

 

Fetch data from cursor A1 while pushing data into the channel to execute the attached computation and keep the result.

12

=A2.result()

 

 

Get channel A2’s result:

13

=B2.result()

 

 

Get channel B2’s result:

14

=C2.result()

 

 

Get channel C2’s result: