4D Pack v13.2

AP Create method

Home

 
4D Pack v13.2
AP Create method

AP Create method 


 

AP Create method ( methodName ; propertiesArray ; methodCode ; folderName ) -> Function result 
Parameter Type   Description
methodName  String in Name of the method (31 chars)
propertiesArray  Longint array in Array of properties (7 elements)
methodCode  BLOB in BLOB containing the method text
folderName  String in Explorer folder in which the method will be created
Function result  Longint in Error code (0=no error)

The AP Create method command lets you add a project method in a 4D database structure (interpreted databases only).

Pass the name of the method in methodName. This name can be up to 31 characters long. It can contain any combination of letters, numbers, spaces and underlines with respect to the standard 4D objects naming rules. If the name contains more than 31 characters, it will be truncated to 31.

The propertiesArray parameter allows defining the method properties. It must have been declared previously as a longint array and must contain 4 items:

  • pass 1 in propertiesArray{1} if the method must be visible and 0 if not.
  • pass 1 in propertiesArray{2} if the method must be available for 4DACTION, 4DMETHOD and 4DSCRIPT, and 0 if not.
  • pass 1 in propertiesArray{3} if the method must be offered as a Web Service and 0 if not.
  • in case of propertiesArray{3}=1, pass 1 in propertiesArray{4} if the method must be published in WSDL and 0 for the other cases.
  • pass 1 in propertiesArray{5} if the method must be shared between components and the host database, and 0 in the opposite case.
  • pass 1 in propertiesArray{6} if the method must be available via SQL, and 0 in the opposite case.
  • pass 1 in propertiesArray{7} if the method must have the "Execute on Server" attribute, and 0 in the opposite case.

Pass a BLOB containing the text of the method in methodCode. If you use the TEXT TO BLOB command to fill the BLOB, pass Mac C string (or 0) in the third parameter of this command.

In methodCode, you can pass the text of a method that has been stored in a file via the Export Method... menu command (in this case, the text includes the commands, constants, etc. as references (tokens) and not words).

In folderName, pass the name of the Explorer folder in which the method will be created. These folders are managed on the Home page of the Explorer window and allow you to organize the objects in a customized manner. This parameter is optional; if it is omitted, the method will be created in the “Default Project Methods” folder.

If the operation is completed successfully, the function returns 0. Otherwise, it returns an error code:
1 = A bad parameter type has been passed.
2 = The database is running in compiled mode.
3 = The method name is an empty string.
4013 = Invalid method name.
4014 = Could not create method.

Note: This command does not work when it is executed from a compiled application that has been merged with 4D Desktop.

 
PROPERTIES 

Product: 4D Pack
Theme: 4D_Pack : Utilities
Number: 61951

 
INDEX

Alphabetical list of commands

 
HISTORY 

Modified: 4D Pack v11.3

 
SEE ALSO 

AP Does method exist
AP Modify method