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 dfx 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 scrpt 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 |
Example:
Below are the contents of script file C:\\test.dfx where arg1 is the cellset parameter:
|
A |
1 |
=connect("demo").query("select * from Students1 where Age>?",arg1) |
2 |
return A1 |
|
A |
|
1 |
=call("C:\\test.dfx",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.dfx"),15) |
One parameter is the script file object and return same result as A1 does. |
Note:
Use the comma to separate the multiple results returned. E.g. return A1,B2.