A.cursor()

Read(1084) 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.

Parameter:

A

A sequence

k

Segment number

n

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

Option:

@p

Assume data is ordered by the first field and the division won’t put records having same first field to different segments

Return value:

Cursor

Example:

 

A

 

1

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

Return a sequence.

2

=A1.cursor(1:3)

Generate a cursor using A1’s sequence, divide the cursor into three segments, and retrieve the 1st segment to return.

3

=A1.cursor()

Generate a cursor using A1’s sequence; return all data of the cursor when parameters are absent.

4

=demo.query("select  CLASS,STUDENTID,SUBJECT,SCORE from SCORES").sort(CLASS)

Return a sequence ordered by the 1st field.

5

=A4.cursor@p(1:3)

With @p option, put records having same Class value in one segment, during which records are not allocated strictly according to parameters k and n.