A. cursor()

Read(464) Label: retrieve, cursor,

Description:

Generate a cursor from a sequence.

Syntax:

A.cursor(k:n)

Note:

The function generates a cursor based on sequence A, divides the cursor data into n segments, and retrieves the kth segment. All segments will be retrieved if parameter k:n is absent.

Parameters:

A

A sequence

k

Segment number

n

The number of data segments; retrieve all data out when both k and n are omitted

Options:

@m

With this option:

A.  cursor@m(n) returns a multicursor; n is the number of segments; use the max number of parallel tasks defined in the designer as the number of segments if n is absent

B.  cursor@m(mcs,K:K’,...) divides an ordered sequence into several segments according to segmenting key K:K’ in sync with ordered multicursor mcs and returns them as a multicursor, too.

Return value:

Cursor/Multicursor

Example:

 

A

 

1

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

 

2

=A1.cursor(1:3)

Divide the cursor generated from A1 into 3 segments, and retrieve the first one to return

3

=A1.cursor@m(3)

Return a multicursor

4

=demo.query("select * from STUDENTS").sort(ID)

Sort the table sequence by ID

5

=demo.query("select * from STUDENTS1").sort(ID).cursor@m()

Sort the table sequence by ID and return it as a multicursor

6

=A4.cursor@m(A5,ID:ID)

Divide A4’s table sequence into multiple segments by ID and return them as a multicursor