4D v13.4

Methods Page

Home

 
4D v13.4
Methods Page

Methods Page  


 

 

The Methods page lists the project methods, database methods, and triggers, as well as project and table form methods for the database. These types of methods are grouped by category.

Note: When components with shared methods are installed in the database, the page displays the Component Methods category as well. This item lists the components installed and their shared methods. This point is detailed in Display of components.

This paragraph describes how to create each type of method from the Explorer.

  • Project Methods: To create a new project method, highlight the Project Methods item in the hierarchical list, or the name of an existing project method, and click the add button .
    You can also create a project method by duplication or copy-paste (see below).
  • Database Methods: You cannot create new database methods. Instead, you can add code to an existing blank database methods. To do so, expand the Database Methods item then double-click the database method to be modified or choose Edit Method... from the context menu or from the options menu. 
  • Triggers: To create a trigger, expand the Triggers item in the hierarchical list; highlight the desired table; then click on the add button or double-click on the table name. You can also choose Edit Method... from the context menu or from the options menu of the page. 
  • Project Form Methods: To create a new method for a project form, expand the Project Form Methods item in the hierarchical list; expand the desired table, and then highlight the desired form. Click the add button or double-click on the form name. You can also choose Edit Method... from the context menu or from the options menu of the page.
  • Table Form Methods: To create a new method for a table form, expand the Table Form Methods item in the hierarchical list; expand the desired table, and then highlight the desired form. Click the add button or double-click on the form name. You can also choose Edit Method... from the context menu or from the options menu of the page.
Note: You can also create a new form method by selecting Edit Form Method... in the context menu or the options menu of the Forms page.

You can display the Web Services Wizard from the Methods page by selecting Web Services Wizard... in the options menu of the page.

The Web Services Wizard appears, ready to be used to discover a Web Service and generate the corresponding proxy methods. For more information about using this wizard, refer to Subscribing to a Web Service in 4D

You can delete any method by highlighting it and clicking on the delete button at the bottom of the page, or by choosing Delete Method... from the context menu.

The manner of deletion depends on the method type:

  • Database methods, Triggers and Form methods: The contents of the method are erased and the method returns to its default “blank” state. A warning dialog box indicates that the deletion is permanent.
  • Project methods: The method is deleted from the list of methods and placed in the Trash. You can recover it from the Trash or delete it permanently (for more information, refer to the Trash Page section).

Click the icon to display the preview area and highlight the method you want to preview. The contents of the method then appear as in the Method editor. You can highlight, then copy or drag and drop, all or part of the contents of the preview area.

You can display or modify the properties of project methods from the Explorer by highlighting a method and choosing the Method Properties... command in the context menu or the options menu of the page.

The “Method Properties” dialog box appears, allowing you to modify the name as well as other method properties.

For more information about the other options of this dialog box, refer to Project method properties.

The Batch setting of attributes... command of the context menu or options menu (applied to project methods only) is used to modify an attribute (Invisible, Available through 4D HTML tags and URLS (4DACTION...), etc.) for all or part of the database project methods in a single operation. For more information about this command, refer to the Batch setting for method attributes paragraph. 

You can execute a database and/or a project method from the Explorer by selecting it and choosing Run Method... from the context menu or the options menu of the page. 

The method is executed in standard mode. For more information, refer to the Executing methods section.

 

You can copy, paste and duplicate project methods from the methods list of the Explorer. These functions allow you to duplicate a method in the same database or to copy it from one database to another. 

To duplicate or copy a method, select it in the list and choose the corresponding command in the context menu or in the options menu of the page. You can then paste the method by choosing Paste in the same context menu.

When you duplicate a method or when a method with the same name already exists in the place where you are pasting it, a number is added to its name, for example MyMethod1. This number is incremented as needed (MyMethod2, MyMethod3, etc.).

 

You can automatically search for the project method dependencies from the Explorer; in other words, other project methods and forms used directly or indirectly by these methods. To do this, you highlight a project method in the Explorer and select Search Dependencies in the context menu or from the options menu on the page.

All the dependencies of the highlighted method are then displayed in a standard Results window. You can open them in their respective editors or select and move them using drag and drop. This makes it easy to transfer complete functionalities between your databases.

You can also highlight several project methods at once and select Search Dependencies. In this case, dependencies for all these methods are displayed in the results window. 

To find dependent project methods, 4D parses the code of the method to detect:

You must pass a parameter name that is a literal constant of the Text type and that matches the name of a valid executable method.

To find a dependent form in the code, 4D looks for a form name passed as a parameter to one of the following commands:

The table parameter of the form is recognized but must be specified explicitly.

4D may not detect a dependency in the following cases:

  //Case of non-detection
 
  //method by reference
 v:="myhandler"
 ON ERR CALL(v)
  //pointer to a table
 DIALOG(Table(1)->;$formname)
  // use of DEFAULT TABLE
 DEFAULT TABLE([myTable])
 DIALOG("myForm") // "myForm" is evaluated as a project form
  // calling a function using FN in SQL code
 Begin SQL
        SELECT Film_Title, {FN How_Many_Actors(ID) AS NUMERIC}
        ...

 
PROPERTIES 

Product: 4D
Theme: Explorer