callx()

Read(373) Label: callx,

Here’s how to use callx() function.

callx( dfx,...;;x )

Description:

Execute the local cellset file dfx through multithreaded processing and return all results as a sequence.

Syntax:

callx(dfx,…;;x)

Note:

The function uses multiple threads to execute the local cellset file dfx. If the value of parameter … is a multi-member sequence, pass the members to their corresponding threads; if the parameter is a single value, just copy it to pass to every thread. The length of the sequence is the number of subtasks to be performed. The number of threads is equivalent to the preffered number of subtasks for the current machine. The extra subtasks will queue up waiting for execution.

Parameter x defines a reduce action. The function returns a sequence consitting of the result sets of the subtasks if x is absent. When x is present, the function calculates the reduce expression using ~, the result of each subtask, and ~~, the current reduce result, replaces ~~ with the result of x to go on calculating reduce and returns the final result of ~~, which is the sequence of all node results.

Parameters:

dfx

The cellset file dfx can be represented by an absolute path or a relative path. The relative path is the search path configured in Tools->Options ->Environment

x

reduce action that can be omitted

The parameter value(s) passed to the dfx file. The format is a sequence. The number of members in the sequence is that of the parameters to be passed in. The multithreaded processing will split the computing task into a number of subtasks according to the length of the sequence parameter, take each member as the parameter value for the dfx file and pass it to the corresponding subtask. If the parameter is a single value, just copy and pass it to every subtask.

Example:

test.dfx is a local file. Its content is as bellows:

 

A

B

1

=connect("demo").query("select * from SCORES  where SUBJECT=?",arg1)

2

return A1

return A1.(SCORE)

 

 

A

 

1

=callx("test.dfx",["English","Math","PE"];)

Local multithreaded processing that passes parameters to test.dfx and returns the query result as a sequence The cellset file is located in the search path configured in Tools->Options ->Environment

2

=callx("test.dfx",["English","Math","PE"];;~~|~)

Local multithreaded processing that passes parameters to test.dfx and executes the reduce action defined by aggregate expression ~~|~, which will concatenate each result returned by the nodes into a string, and returns a sequence of such strings