4D v16.3METHOD SET CODE |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v16.3
METHOD SET CODE
METHOD SET CODE
The METHOD SET CODE command modifies the code of the method(s) designated by the path parameter with the contents passed in the code parameter. This command can access the code of all types of methods: database methods, triggers, project methods, form methods and object methods. In the case of a project method: if this method already exists in the database, its contents are replaced; if it does not exist, it is created with its contents. You can use two types of syntaxes, based either on text arrays, or text variables: C_TEXT(tVpath) // text variables ARRAY TEXT(arrPaths;0) // text arrays You cannot mix the two syntaxes. If you pass an invalid pathname, the command does nothing. . When METHOD SET CODE is called, the method attributes are reset by default. However, if the first line of the method code contains valid metadata (expressed in JSON), they are used to specify the method attributes and the first line is not inserted. Example of metadata: // %attributes = {"invisible":true,"lang":"fr","folder":"Security"} Note: These metadata are generated automatically by the METHOD GET CODE command. For more information about supported attributes, refer to the description of the METHOD SET ATTRIBUTES command. Concerning the "folder" property of the metadata:
You can execute this command from a component, but in this case, you must pass the * parameter because access to the component code is read-only. If you omit the * parameter in this context, the error -9763 is generated This example exports and imports all the project methods of an application: $root_t:=Get 4D folder(Database folder)+"methods"+Folder separator
See also
|
PROPERTIES
Product: 4D
HISTORY
Created: 4D v13 ARTICLE USAGE
4D Language Reference ( 4D v16) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||