cursor()

Read(1290) Label: genrate a cursor, path,

Description:

 Call a cellset file and return the result set returned from the execution of the file as a cursor.

Syntax:

cursor(spl,…)

Note:

The function calls a cellset file and returns the result set returned from the execution of the file as a cursor. When there are multiple return statements in the spl file, first merge the result sets returned by the return statements, and then return the merge result as a cursor. These result sets of return must be of the same structure, or error will be reported. Use either an absolute path or a relative path to search for the spl file. With the relative path, the search order is Class path –> Search path –> Main directory. The cursor the function returns is irreversible.

Parameter:

spl

Cellset file name

spl’s parameter

Option:

@c

The spl can be represented by a cell that corresponds to a subroutine defined by func() function

Return value:

Cursor

Example:

Here’s test.splx cellset file under the main directory in which arg1 is the cellset parameter:

 

A

B

 

1

for arg1

 

 

2

 

=connect("demo").query("select * from GYMNASTICSWOMEN where ID=?",A1)

 

3

 

=B2.derive(avg(VAULT,UNEVENBARS,BALANCEBEAM,FLOOR):Average)

 

4

 

return B3

Perform a loop computation and return the result sets.

 

 

A

 

1

=[5,10,20,25]

 

 

2

=cursor("test.splx",A1)

Cll test.spl, pass A1’s sequence as the value of parameter arg1, and return result as a cursor.

3

=A2.fetch()

Fetch records from the cursor; the result is the union of returned result sets by the loop computation of test.splx.

4

=call("test.splx",A1)

Use call function to call test.splx but only the result set of the first loop is returned. 

 

 

A

B

 

1

func

 

 

2

 

return A1.sum()

 

3

=cursor@c(A1,[2,5,7])

 

Call the code block whose master cell is A1.

4

=A3.fetch()

 

14.