Command name

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, 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.

4th Dimension 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, 4th Dimension also includes a unique feature, the EXECUTE 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 statements in English, looks like:

   EXECUTE ( "DEFAULT TABLE([MyTable])")
   EXECUTE ( "ALL RECORDS([MyTable])")

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

   EXECUTER ( "DEFAULT TABLE([MyTable])")
   EXECUTER ( "ALL RECORDS([MyTable])")

4D automatically translates EXECUTE (English) to EXECUTER (French), but cannot translate the text statement you passed to the command.

If you use the EXECUTE 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 (Command name (46)+"([MyTable])")
   EXECUTE (Command name (47)+"([MyTable])")

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

   EXECUTER (Nom commande (46)+"([MyTable])")
   EXECUTER (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 (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. Second, 4D Insider will retrieve the references to the object whose pointer you pass. Third, as in the previous example, your code can cease to work correctly if you rename the table. However, in certain cases, using EXECUTE 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.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next