Command name

4D - Documentation   Français   English   German   Spanish   Japanese   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next

version 6.0


Command name (command) String

ParameterTypeDescription
commandNumberCommand number
Function resultStringLocalized command name

Description

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: To know the number of a command, refer to the Command Syntax by Name section.

Examples

1. 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+"];"INPUT FORM")")
   Else
      If (Count parameters>=1)
         INPUT FORM ($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.

2. 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.

See Also

Command Syntax by Name, EXECUTE FORMULA.


4D - Documentation   Français   English   German   Spanish   Japanese   4D v11 SQL, Command Theme List   4D v11 SQL, Command Alphabetical List   4D v11 SQL, Constant Theme List   Back   Previous   Next