4D v14.3

METHOD GET CODE

Home

 
4D v14.3
METHOD GET CODE

METHOD GET CODE 


 

METHOD GET CODE ( path ; code {; *} ) 
Parameter Type   Description
path  Text, Text array in Text or Text array containing one or more method path(s)
code  Text, Text array in Code of designated method(s)
Operator in If passed = command applies to host database when executed from a component (parameter ignored outside of this context)

The METHOD GET CODE command returns, in the code parameter, the contents of the method(s) designated by the path parameter. This command can return the code of all types of methods: database methods, triggers, project methods, form methods and object methods.

You can use two types of syntaxes, based either on text arrays, or text variables:

 C_TEXT(tVpath// text variables
 C_TEXT(tVcode)
 METHOD GET CODE(tVpath;tVcode) // code of a single method

 ARRAY TEXT(arrPaths;0) // text arrays
 ARRAY TEXT(arrCodes;0)
 METHOD GET CODE(arrPaths;arrCodes) // code of several methods

You cannot mix the two syntaxes.

If you pass an invalid pathname, the code parameter is left empty and an error is generated. 

In the text of the code generated by this command:

  • Command names are written in English in all versions of 4D except for the French version (where they are written in French).
  • A line is added in the header of the code generated containing metadata used when importing code, for example:
      // %attributes = {"lang":"fr","invisible":true,"folder":"Web3"}

    During an import, this line is not imported and only the specified attributes are taken into account. The "lang" attribute sets the export language and prevents an import into an application in a different language (in this case, an error is generated). The "folder" attribute contains the name of the method’s parent folder; it is not shown when the method does not have a parent folder.

If the command is executed from a component, it applies by default to the component methods. If you pass the * parameter, it accesses the methods of the host database.

Example  

Refer to the example of the METHOD SET CODE command.

 
PROPERTIES 

Product: 4D
Theme: Design Object Access
Number: 1190

 
HISTORY 

New
Created: 4D v13
Modified: 4D v14

 
SEE ALSO 

METHOD SET CODE

 
ARTICLE USAGE

4D Language Reference ( 4D v14 R2)
4D Language Reference ( 4D v14 R3)
4D Language Reference ( 4D v14.3)
4D Language Reference ( 4D v14 R4)

Inherited from : METHOD GET CODE ( 4D v13.5)