4D v14.3

Executing methods

Home

 
4D v14.3
Executing methods

Executing methods  


 

 

Project methods written in your application are usually called automatically during the use of the application via menu commands, buttons, other methods, and so on. As for database methods, they are executed in relation to specific events that occur in the application. 

However, for testing and debugging purposes, 4D lets you manually execute project methods and certain database methods in Design mode. In this case, it is possible to run the method in a new process and/or directly in Debug mode, in order to check its execution step by step.

Moreover, with 4D Server, you can indicate whether 4D Server should execute a project method on the server machine or on other clients’ machines. You can execute methods in two ways:

  • From the Method editor window,
  • From the Execute Method dialog box (project methods only).

Each Method editor window has a button that can be used to run the current method. Using the menu associated with this button, you can choose the type of execution desired:

This button is only active for project methods and for the following database methods:

  • On Startup
  • On Exit
  • On Server Startup
  • On Server Shutdown

The following execution modes are available:

  • Run new process: Creates a process and runs the method in standard mode in this process.
  • Run and debug new process: Creates a new process and displays the method in the Debugger window for step by step execution in this process.
  • Run in Application process: Runs the method in standard mode in the context of the Application process (in other words, the record display window).
  • Run and debug in Application process: Displays the method in the Debugger window for step by step execution in the context of the Application process (in other words, the record display window).

When you select the Method... command of the Run menu,  displays the Execute Method dialog box:

This dialog box lists all the project methods of the database, including shared project methods of components. On the other hand, project methods that have been declared invisible will not appear. 

To execute a project method, simply select its name in the list and click on Execute. To run a method step by step in Debug mode, click on Debug. For more information about the 4D debugger, refer to the Debugging chapter the 4D Language Reference manual.

4D Server Note: The Debug option is not available if you execute the method on the server.

If you check the New Process check box, the method you selected executes in another process. If the method is performing a time-consuming task such as printing a large set of records, you can continue to work with your database, adding records to a table, creating a graph to display data, and so on. For more information about processes, refer to Processes the 4D Language Reference manual.

4D Server Note:

  • If you want the method to be executed on the server machine rather than on the client machine, select the On 4D Server option in the To be executed menu. In this case, a new process, call the stored procedure, is created on the server machine in order to execute the method.
    This option can be used to reduce network traffic and optimize the functioning of 4D Server, in particular for methods that call data stored on the disk. All types of methods can be executed on the server machine or on another client machine, except for those that modify the user interface. In this case, stored procedures are ineffective.
  • You can also choose to run the method on another client workstation. Other client workstations will not appear in the menu, unless they have been previously “registered” (for more information, refer to the description of the REGISTER CLIENT command in the 4D Language Reference manual).
    By default, the locally option is selected. With the 4D single-user version, this is the only option available.

 
PROPERTIES 

Product: 4D
Theme: Editing methods

 
TAGS 

Procédures stockées

 
ARTICLE USAGE

4D Design Reference ( 4D v14 R2)
4D Design Reference ( 4D v12.4)
4D Design Reference ( 4D v13.4)
4D Design Reference ( 4D v14 R3)
4D Design Reference ( 4D v14.3)
4D Design Reference ( 4D v14 R4)