cs .select()

Read(987) Label: original cursor,

Description:

Attach the record filtering action to a cursor and return the original cursor.

Syntax:

cs.select(x)

Note:

The function attaches a computation to cursor cs, which will calculate expression x against each of the records in cursor cs and get records that make value of x true, and return the original cursor cs.

 

When parameter x is omitted, get all records of cursor cs. The function supports multicursors.

 

This is a delayed function.

Option:

@c

Enable getting the eligible member(s) beginning from the first member that makes Boolean expression x true from left to right until the first ineligible member that makes Boolean expression x false appears.

@v

Use column-wise computation when parameter cs is a column-wise cursor and also return a column-wise cursor.

Parameter:

cs

A cursor

x

A Boolean value

Return value:

Cursor

Example:

 

A

 

1

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

Return a cursor:

2

=A1.select(STUDENTID>10)

Attach a computation to cursor A1, which will select records where STUDENTID is greater than 10 from the cursor, and return cursor A1:

3

=A1.fetch()

Fetch data from cursor A1 where A2’s computation is executed (it would be better that data is fetched in batches when a large amount of data is involved):

 

When using @v option:

 

A

 

1

=connect("demo").cursor@v("select * from employee")

Return a column-wise cursor.

2

=A1.select@v(DEPT=="HR")

Perform column-wise computation.

 

When using @c option:

 

A

 

1

=[4,8,10,3,5,7,9,11,13,7].cursor()

 

2

=A1.select@c(~>7)

@c option enables to get members from the first member greater than 7 until the first member less than 7 appears.

3

=A2.fetch()

Result: [8,10].