call()

Read(2857) 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 filespl while passing in values of parameters arg1,…, returns the first value that spl returns, and ends the invocation.

 

Values arg1,… will be passed to the script file’s parameters in order, which are irrelevant to parameter names.

 

Search for the relative path of the spl file in the order of Class path -> Search path -> Main path. The default main path is the current path.

 

 

Parameter:

spl

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

arg1,

Values passed to parameters used in the spl file.

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.

@j

Work with @f option to register the function for a specific task; by default, it will be registered for the global use.

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 as global use.

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.

Related function:

func fn()