Skip to main content
Version: 20 R7 BETA

METHOD GET PATHS

METHOD GET PATHS ( {folderName ;} methodType ; arrPaths {; stamp}{; *} )

ParameterTypeDescription
folderNameTextName of Home page folder
methodTypeIntegerSelector of method type to get
arrPathsText arrayArray of method paths and names
stampRealMinimum value of stamp
New current value
*OperatorIf passed = command applies to host database when executed from a component (parameter ignored outside of this context)

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

Description

The METHOD GET PATHS command fills the arrPaths array with the internal pathnames and names of methods in the application that are of the type specified by the methodType parameter.

If your code is organized in "folders" in the 4D Explorer (Home page), you can pass a folder name in the optional folderName parameter. In this case, the arrPaths array only contains paths of methods that are found in this location.

Note: You cannot use the "@" character in folderName.

In the methodType parameter, you pass the type of method whose paths you want to get in the arrPaths array. You can use the following constants (individually or a combination of them), found in the Design Object Access theme:

ConstantTypeValueComment
Path all objectsInteger-1Paths of all the methods of the database
Path classInteger32Path of class definition. Example:
[class]/Person
[class]/Student
Path database methodInteger2Path of database methods specified. List of these methods:
[databaseMethod]/onStartup
[databaseMethod]/onExit
[databaseMethod]/onDrop
[databaseMethod]/onBackupStartup
[databaseMethod]/onBackupShutdown
[databaseMethod]/onWebConnection
[databaseMethod]/onWebAuthentication
[databaseMethod]/onWebSessionSuspend
[databaseMethod]/onServerStartup
[databaseMethod]/onServerShutdown
[databaseMethod]/onServerOpenConnection
[databaseMethod]/onServerCloseConnection
[databaseMethod]/onSystemEvent
[databaseMethod]/onSqlAuthentication
[databaseMethod]/ onHostDatabaseEvent
[databaseMethod]/ onRESTAuthentication
[databaseMethod]/ onMobileAppAuthentication
[databaseMethod]/ onMobileAppAction
Path project formInteger4Path of project form methods and all their object methods. Examples:
[projectForm]/myForm/{formMethod}
[projectForm]/myForm/button1
[projectForm]/myForm/mylist
[projectForm]/myForm/button1
Path project methodInteger1Name of method.
Example: MyProjectMethod
Path table formInteger16Path of table form methods and all their object methods. Example:
[tableForm]/table_1/Form1/{formMethod}
[tableForm]/table_1/Form1/button1
[tableForm]/table_1/Form1/mylist
[tableForm]/table_2/Form1/mylist
Path triggerInteger8Path of database triggers. Example:
[trigger]/table_1
[trigger]/table_2

The stamp parameter lets you only get the paths of methods modified after a specific point in time. As part of a version control system, this means that you can update only methods that were modified since the last backup.
Here is how it works: 4D maintains a counter of method modifications. Each time a method is created or saved again, this counter is incremented and its current value is stored in the internal stamp of the method.
If you pass the stamp parameter, the command only returns methods whose stamp is greater than or equal to the value passed in this parameter. Moreover, the command returns, in stamp, the new current value of the modification counter, i.e. the highest value. If you save this value, you can pass it the next time this command is called so that you only get new or modified methods.

If the command is executed from a component, it returns by default the paths of the component methods. If you pass the * parameter, the array contains the paths of the methods of the host database.

If the command detects a duplicated method name, the error -9802 is generated ("Object path not unique"). In this case, it is advisable to use the MSC in order to verify the database structure.

Example 1

Retrieval of project methods found in the "web" folder:

 METHOD GET PATHS("web";Path project method;arrPaths)

Example 2

Retrieval of database methods and triggers:

 METHOD GET PATHS(Path trigger+Path database method;arrPaths)

Example 3

Retrieval of project methods that were modified since the last backup:

  // we load the last saved value
 $stamp :=Max([Backups]cur_stamp)
 METHOD GET PATHS(Path project method;arrPaths;$stamp)
  // we save the new value
 CREATE RECORD([Backups])
 [Backups]cur_stamp :=$stamp
 SAVE RECORD([Backups])

Example 4

Refer to the example of the METHOD SET CODE command.

See also

Current method path
METHOD GET FOLDERS