4D v13.4

LISTBOX INSERT COLUMN FORMULA

Home

 
4D v13.4
LISTBOX INSERT COLUMN FORMULA

LISTBOX INSERT COLUMN FORMULA 


 

LISTBOX INSERT COLUMN FORMULA ( {* ;} object ; colPosition ; colName ; formula ; dataType ; headerName ; headerVar {; footerName ; footerVar} )  
Parameter Type   Description
Operator in If specified, object is an object name (string) If omitted, object is a variable
object  Form object in Object name (if * is specified) or Variable (if * is omitted)
colPosition  Longint in Location of column to insert
colName  String in Name of the column object
formula  String in 4D formula associated with column
dataType  Longint in Type of formula result
headerName  String in Name of the column header object
headerVar  Integer variable in Column header variable
footerName  String in Column footer object name
footerVar  Integer variable in Column footer variable

The LISTBOX INSERT COLUMN FORMULA command inserts a column into the listbox designated by the object and * parameters.

The LISTBOX INSERT COLUMN FORMULA command is similar to the LISTBOX INSERT COLUMN command except that it can be used to enter a formula as the contents of a column.

This type of contents can only be used when the “Data Source” property of the list box is set to Current Selection or Named Selection (for more information about this, please refer to the Managing List Box Objects section).

Note: This command does nothing if it is applied to the first column of a list box displayed in hierarchical mode.

If you pass the optional * parameter, you indicate that the object parameter is an object name (string). If you do not pass this parameter, you indicate that the object parameter is a variable. In this case, you pass a variable reference instead of a string. For more information about object names, please refer to the Object Properties section.

The new column is inserted just before the column designated by the colPosition parameter. If the colPosition parameter is greater than the total number of columns, the column will be added after the last column.

Pass the object name of the inserted column in the colName parameter.

The formula parameter can contain any valid expression, i.e.:

  • An instruction,
  • A formula generated using the Formula editor,
  • A call to a 4D command,
  • A call to a project method.

At the moment the command is called, the formula is parsed then executed.

Note: Use the Command name command in order to define formulas that are independent from the application language (when they call on 4D commands).

The dataType parameter can be used to designate the type of data resulting from the execution of the formula. You must pass one of the following constants of the “Field and Variable Types” theme in this parameter:

Constant Type Value
Is Boolean Longint 6
Is Date Longint 4
Is Picture Longint 3
Is Real Longint 1
Is Text Longint 2
Is Time Longint 11

If the result of the formula does not correspond to the expected data type, an error is generated.

In the headerName and headerVar parameters, pass the object name and variable of the column header inserted.

In the footerName and footerVar parameters, you can also pass the object name and variable of the footer of the inserted column. If you omit the footerVar parameter, 4D uses a dynamic variable.

Note: Object names must be unique in a form. You need to make sure that the names passed in the colName, headerName and footerName parameters are not already used. Otherwise, the column is not created and an error is generated.

Example  

We want to add a new column to the right of the list box that will contain a formula which calculates an empolyee's age:

 vAge:="Current Date-[Employees]BirthDate)\365"
 $last:=LISTBOX Get number of columns(*;"ListBox1")+1
 LISTBOX INSERT COLUMN FORMULA(*;"ListBox1";$last;"ColFormula";vAge;Is Real;"Age";HeaderVar)

 
PROPERTIES 

Product: 4D
Theme: List Box
Number: 970

 
INDEX

Alphabetical list of commands

 
HISTORY 

New
Created: 4D v11 SQL
Renamed: 4D v12
Modified: 4D v13

 
SEE ALSO 

LISTBOX INSERT COLUMN