ch.()

Description:

Compute a given expression over each member in a channel.

Syntax:

ch.(x)

ch.()    Return the channel ch itself

Note:

The function computes a given expression over each member in a channel and returns the results as a channel. Use ~ to reference the current member in the expression. This is an attached computation.

Parameter:

ch

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:

A new channel consisting of the results of computing the expression over each member of a channel

Example:

 

A

B

C

 

1

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

 

 

 

2

=channel()

=channel()

=channel()

Create a channel

3

=A2.(age(BIRTHDAY))

 

 

Compute age(BIRTHDAY) on BIRTHDAY’s members in A2’s channel and return result to the channel

4

=A2.fetch()

 

 

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

5

=B2.(SALARY)

 

 

Compute SALARY column in B2’s channel

6

=B2.(~*~)

 

 

Use ~ to reference the current member of a sequence to compute SALARY*SALARY and return result to B2’s channel

7

=B2.fetch()

 

 

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

8

=C2.()

 

 

Return channel C2

9

=C2.fetch()

 

 

Attach ch.fetch() function that gets the final result set to C2’s channel to fetch and store the existing data in the 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()

 

 

Data in A1’s cursor is pushed into the channel and operations are performed as data retrieval is performed over A1

12

=A2.result()

 

 

13

=B2.result()

 

 

14

=C2.result()