4D v13.4

Design Object Access Commands

Home

 
4D v13.4
Design Object Access Commands

Design Object Access Commands  


 

 

With 4D, you can access the contents of methods in your applications by programming. This source toolkit facilitates the integration into your applications of code control tools and more particularly version control systems (VCS). It also lets you implement advanced systems for code documentation, for building a custom explorer or for organizing scheduled backups of the code saved as disk files.

The following principles are implemented:

  • Each method and form in a 4D application has its own address in the form of a pathname. For example, the trigger method for table 1 can be found at "[trigger]/table_1". Each object pathname is unique in an application.
    Note: To ensure the uniqueness of pathnames, 4D no longer lets you create objects with the same name on different form pages. In databases converted from versions prior to 4D v13, the MSC detects these duplicate names.
  • Most of the commands in this theme work in both interpreted and compiled mode. However, commands that modify properties or access contents executable from methods can only be used in interpreted mode (see the table below).
  • You can use all the commands of this theme with 4D in local or remote mode.
    However, keep in mind that you cannot use certain commands in compiled mode: the purpose of this theme is to create custom development support tools. You must not use these commands to dynamically change the functioning of a database that is running. For example, you cannot use METHOD SET ATTRIBUTE to change a method attribute according to the status of the current user.
  • When a command of this theme is called from a component by default it accesses the component objects. In this case, to access objects of the host database, you just pass a * as the last parameter. Note that in this context, this syntax is only possible for commands that modify objects (such as METHOD SET ATTRIBUTE), because components are always executed in read-only mode.

For reasons related to the principle of the compilation process, only certain commands in this theme can be used in compiled mode. The following table indicates the available of the commands in compiled mode:

CommandCan be used in compiled mode
Current method pathYes
FORM GET NAMESYes
METHOD SET ATTRIBUTENo (*)
METHOD SET CODENo (*)
METHOD SET COMMENTSNo (*)
METHOD SET ACCESS MODEYes
METHOD Get attributeYes
METHOD Get pathYes
METHOD GET PATHSYes
METHOD GET PATHS FORMYes
METHOD GET CODENo (*)
METHOD GET COMMENTSYes
METHOD GET MODIFICATION DATEYes
METHOD GET FOLDERSYes
METHOD GET NAMESYes
METHOD OPEN PATHNo (*)
METHOD RESOLVE PATHYes

(*) The error -9762 "The command cannot be executed in a compiled database." is generated when the command is executed in compiled mode.

By default, no file is created on disk by 4D. However, pathnames generated for objects are compatible with the file management of the operating system; they can generate files directly on disk using your own import/export methods. 

More specifically, forbidden characters such as ":" are encoded in method names. Generated files may be integrated automatically in a version control system.
Here are the encoded characters:

CharacterEncoding
"%22
*%2A
/%2F
:%3A
<%3C
>%3E
?%3F
|%7C
\%5C
%%25

Examples:
Form?1 is encoded Form%3F1
Button/1 is encoded Button%2F1

 
PROPERTIES 

Product: 4D
Theme: Design Object Access