4D v15.4

Command name

Home

 
4D v15.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 usefulness of this command has been greatly reduced over time as 4D continues to evolve:

  • For non-tokenized statements (formulas), 4D provides a token syntax which you can use to avoid potential problems due to variations in command names, while still being able to type these names in a legible manner. This syntax can also be used for the names of other language elements, such as tables or fields. For more information about this point, refer to the Using tokens in formulas section.
  • Beginning with 4D v15, the English version of the programming language is used by default in all 4D language versions, reducing the needs related to the database localization.

The Command name command returns the name of the command whose command number you pass in command.

This name may vary from one 4D version to the next (commands renamed) or according to the application language(*).

(*) By default, the English language version is used starting with 4D v15; nevertheless, the "Use regional system settings" option on the Methods Page of the Preferences allows you to continue using the French language in a French version of 4D.

Note: The number of each command is provided in the Properties area of the 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).

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)
       asCommand{2}:=Command name(2)
       asCommand{3}:=Command name(4)
       asCommand{4}:=Command name(3)
  ` ...
 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.

*with a 4D application configured to use the French programming language (see compatibility note)

The following code allows you to load all valid 4D commands in an array:

 C_LONGINT($Lon_id)
 C_TEXT($Txt_command)
 ARRAY LONGINT($tLon_Command_IDs;0)
 ARRAY TEXT($tTxt_commands;0)
 
 Repeat
    $Lon_id:=$Lon_id+1
    $Txt_command:=Command name($Lon_id)
    If(OK=1) //command number exists
       If(Length($Txt_command)>0) //command is not disabled
          APPEND TO ARRAY($tTxt_commands;$Txt_command)
          APPEND TO ARRAY($tLon_Command_IDs;$Lon_id)
       End if
    End if
 Until(OK=0) //end of existing commands



See also 

EXECUTE FORMULA

 
PROPERTIES 

Product: 4D
Theme: Language
Number: 538

The OK variable is changed by the command

 
HISTORY 

Created: 4D v6

 
ARTICLE USAGE

4D Language Reference ( 4D v15)
4D Language Reference ( 4D v15.4)
4D Language Reference ( 4D v15.3)