Tech Tip: Use LISTBOX INSERT COLUMN FORMULA to insert columns in ORDA-based listbox
PRODUCT: 4D | VERSION: 19 | PLATFORM: Mac & Win
Published On: June 28, 2022
To insert a column to a collection-based listbox via code can be done using the command LISTBOX INSERT COLUMN FORMULA. Take the example a collection-based listbox is assigned the value Form.lb which will display a column with table field [Table_1]Field_2. Instead of passing a pointer to a table field, the formula argument of the command LISTBOX INSERT COLUMN FORMULA will be given the value of "This.Field_2" as shown below:
C_TEXT($objName_t) C_LONGINT($colPos_l) C_TEXT($colName_t) C_TEXT($formula_t) C_LONGINT($dataType_l) C_TEXT($headerName_t) C_LONGINT(headerVar_l) $objName_t:="List Box" $colPos_l:=1 $colName_t:="Field_2" $formula_t:="This.Field_2" $dataType_l:=Is text $headerName_t:=$colName_t LISTBOX INSERT COLUMN FORMULA(*;$objName_t;$colPos_l;$colName_t;$formula_t;$dataType_l;$headerName_t;headerVar_l) OBJECT SET TITLE(headerVar_l;$colName_t) Form.lb:=ds.Table_1.all() |
When the code is executed, a new column should have successfully been inserted.