Skip to main content
Version: Next

EXECUTE ON CLIENT

EXECUTE ON CLIENT ( clientName ; methodName {; param}{; param2 ; ... ; paramN} )

ParameterTypeDescription
clientNameText4D Client’s registered name
methodNameTextName of the method to execute
paramMethod’s parameter(s)

This command is not thread-safe, it cannot be used in preemptive code.

Description

The EXECUTE ON CLIENT command forces the execution of the methodName method, with the parameters param1... paramN, if necessary, on the registered 4D Client whose name is clientName. 4D Client’s registered name is defined by the REGISTER CLIENT command.

This command can be called from a 4D Client or a stored method from 4D Server.

If the method requires one or more parameters, pass them after the name of the method.
The execution of the method on 4D Client is done in a process automatically created on the client workstation, and its name will be the 4D Client’s registered name.

If this command is called many times in a row on the same 4D Client, the execution orders will be stacked. Therefore, the methods will be treated one after another in asynchronous mode. The more methods that are stacked, the bigger the workload is for the 4D Client. You can know the state of the workload of each client by using the GET REGISTERED CLIENTS command.

Note: The stacking of the execution orders cannot be modified or stopped unless 4D Client is unregistered by using the UNREGISTER CLIENT command.

You can simultaneously execute the same method on many or all of the registered 4D Clients. To do so, use the wildcard character (@) in the clientName parameter.

Example 1

Let’s assume that you want to execute the “GenerateNums” method on the “Client1” client station:

 EXECUTE ON CLIENT("Client1";"GenerateNums";12;$a;"Text")

Example 2

If you want all the clients to execute the “EmptyTemp” method:

 EXECUTE ON CLIENT("@";"EmptyTemp")

Example 3

Refer to the example of the REGISTER CLIENT command.

System variables and sets

The OK system variable is equal to 1 if 4D Server has correctly received the execution request of a method; however, this does not guarantee that the method has been properly executed by 4D Client.

See also

Execute on server
GET REGISTERED CLIENTS
REGISTER CLIENT
UNREGISTER CLIENT