call()

Read(2443) Label: cellset file, first result set,

Description:

Call a script file and return the first result set.

Syntax:

call(spl,arg1,…)

Note:

The function calls script file .dfx/.splx/.spl while passing in the parameter arg1,…, returns the first value that spl returns, and ends the invocation. It is a non-cellset function and so can be used outside the cellset. The function will automatically use the @s option to search for the .dfx/.splx/.spl among the file names with non-absolute paths in a specified order: Class path -> Search path -> Main path. The default main path is the current path.

 

When calling the call function, parameters arg1,... will be assigned to .dfx/.splx/.spl’s parameters in order, which is irrelevant to the parameter names in .dfx/.splx/.spl’s parameter list.

Parameter:

spl

A script file or script file object in the format of .dfx/.splx/.spl.

arg1,

Parameters.

Option:

@r

Disable the default buffer call.

@n

Generate a new task space and execute the script file using a new thread, and return the task space without waiting for the result to return; usually, the option is used to execute a script file that performs timed tasks or loop operations.

@f

Execute script file spl and register functions of func fn(…)format in it; call@f cannot be used in a multithreaded environment.

Example:

Below are the contents of script file C:\\test.splx where arg1 is the cellset parameter:

 

A

1

=connect("demo").query("select * from Students1 where Age>?",arg1)

2

return A1

 

Call script file test.splx:

 

A

 

1

=call("C:\\test.splx",15)

Call the script file and return the first returned value. Query the data of students who are above 15 years old.

2

=call(file("C:\\test.splx"),15)

One parameter is the script file object and return same result as A1 does.

 

Below is script file ca01.splx, where arg1 is cellset parameter:

 

A

B

1

func  cf(arg1)

 

2

 

=arg1*10

3

 

return B2

4

=cf(arg1)

 

 

Execute ca01.splx and register functions:

 

A

 

1

=call@f("ca01.splx",9)

Execute ca01.splx and return 90 while registering function cf() in the script file.

2

=cf(3)

Call the registered function in A1 and 30.

Note:

Use the comma to separate the multiple results returned. E.g. return A1, B2.