register()

Read(3092) Label: dfx, register, function, call,

Description:

Register a .dfx/.splx/.spl file as a function to be called.

Syntax:

register(f,spl)

Note:

The function registers a script file spl as function f to call it in a cellset script. Syntax of the function expression is f(xi,...), where xi,... is a parameter in the spl file. Use the comma to separate multiple parameters.

 

The function name is the one registered the last time.

 

The function cannot work in a multithreaded environment.

Parameter:

f

Function name.

spl

.dfx/.splx/.spl file path, which can be an absolute path or a relative path; a relative path is relative to the main directory.

Option:

@o

In a function registered with @o, o in the invocation expression fn@o is the first (string) parameter value. If no option is specified in the invocation expression, the first (string) parameter value passed is regarded as null.

Return value:

Result of executing the script file

Example:

Below is emp.splx:

 

A

1

=connect("demo")

2

In the invocation expression fn@o,

3

return A2

 

Register emp.splx as a function and call it:

 

A

 

1

=register("df1","D:/emp.splx")

Register emp.splx as df1 function.

2

=df1("HR","M")

Call the registered function and pass parameter value:

 

Use @o option to register functions:

 

A

 

1

=register@o("df2","D:/emp.splx")

Use @o option to register emp.splx as a function and name it df2.

2

=df2@HR("M")

Call the function registered with the @o method, pass HR to it as value of parameter arg1, and return the following result:

3

=df2("HR","M")

As df2 is registered through @o option, pass null value to the first parameter when df2() expression does not use that option and return an empty table sequence.