4D v14.3Command name |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v14.3
Command name
Command name
The Command name command returns the literal name of the command whose command number you pass in command. 4D integrates a dynamic translation of the keywords, constants, and command names used in your methods. For example, if you use the English version of 4D, you write: DEFAULT TABLE([MyTable]) This same code, reopened with the French version of 4D, will read: TABLE PAR DEFAUT([MyTable]) However, 4D also includes a unique feature, the EXECUTE FORMULA command, which allows you to build code on the fly and then execute this code, even though the database is compiled. The example code, written with EXECUTE FORMULA statements in English, looks like: EXECUTE FORMULA("DEFAULT TABLE([MyTable])") This same code, reopened with the French version of 4D, will then read: EXECUTER FORMULE("DEFAULT TABLE([MyTable])") 4D automatically translates EXECUTE FORMULA (English) to EXECUTER FORMULE (French), but cannot translate the text statement you passed to the command. If you use the EXECUTE FORMULA command in your application, you can use Command name to eliminate international localization issues for statements you execute in this way, and thus make your statements independent of language. The example code becomes: EXECUTE FORMULA(Command name(46)+"([MyTable])") With a French version of 4D, this code will read: EXECUTER FORMULE(Nom commande(46)+"([MyTable])") Note: The number of each command is provided in the Properties area of the command documentation page. The Command name command sets the OK variable to 1 if command corresponds to an existing command number, and to 0 otherwise. Note, however, that some existing commands have been disabled, in which case Command name returns an empty string (see last example). For all the tables of your database, you have a form called “INPUT FORM” used for standard data entry in each table. Then, you want to add a generic project method that will set this form as the current input form for the table whose pointer or name you pass. You write:
` STANDARD INPUT FORM project method After this project method has been added to your database, you write: STANDARD INPUT FORM(->[Employees]) Note: Usually, it is better to use pointers when writing generic routines. First, the code will run compiled if the database is compiled. Then, as in the previous example, your code can cease to work correctly if you rename the table. However, in certain cases, using EXECUTE FORMULA will solve the problem. In a form, you want a drop-down list populated with the basic summary report commands. In the object method for that drop-down list, you write: Case of In the English version of 4D, the drop-down list will read: Sum, Average, Min, and Max. In the French version, the drop-down list will read: Somme, Moyenne, Min, and Max. The following code allows you to load all valid 4D commands in an array: C_LONGINT($Lon_id) |
PROPERTIES
Product: 4D
HISTORY
Created: 4D v6 SEE ALSO ARTICLE USAGE
4D Language Reference ( 4D v12.4) Inherited from : Command name ( 4D v11 SQL Release 6) |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||