4D v13.4

Command name

Home

 
4D v13.4
Command name

Command name 


 

Command name ( command ) -> Function result 
Parameter Type   Description
command  Longint in Command number
Function result  String in Localized 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])
 ALL RECORDS([MyTable])

This same code, reopened with the French version of 4D, will read:

 TABLE PAR DEFAUT([MyTable])
 TOUT SELECTIONNER([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])")
 EXECUTE FORMULA("ALL RECORDS([MyTable])")

This same code, reopened with the French version of 4D, will then read:

 EXECUTER FORMULE("DEFAULT TABLE([MyTable])")
 EXECUTER FORMULE("ALL RECORDS([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])")
 EXECUTE FORMULA(Command name(47)+"([MyTable])")

With a French version of 4D, this code will read:

 EXECUTER FORMULE(Nom commande(46)+"([MyTable])")
 EXECUTER FORMULE(Nom commande(47)+"([MyTable])")

Note: The number of each command is provided in the Properties area of the command documentation page.

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
  ` STANDARD INPUT FORM ( Pointer {; String })
  ` STANDARD INPUT FORM ( ->Table {; TableName })
 C_POINTER($1)
 C_STRING(31;$2)
 
 If(Count parameters>=2)
    EXECUTE FORMULA(Command name(55)+"(["+$2+"];"+Char(Double quote)+"INPUT FORM"+Char(Double quote)+")")
 Else
    If(Count parameters>=1)
       FORM SET INPUT($1->;"INPUT FORM")
    End if
 End if

After this project method has been added to your database, you write:

 STANDARD INPUT FORM(->[Employees])
 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
    :(Form event=On Before)
       ARRAY TEXT(asCommand;4)
       asCommand{1}:=Command name(1) ` Sum
       asCommand{2}:=Command name(2) ` Average
       asCommand{3}:=Command name(4) ` Min
       asCommand{4}:=Command name(3) ` Max
  ` ...
 End case

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.

 
PROPERTIES 

Product: 4D
Theme: Language
Number: 538

 
INDEX

Alphabetical list of commands

 
HISTORY 

Created: 4D v6

 
SEE ALSO 

EXECUTE FORMULA