KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Enhancing the display of boolean data in a listbox column when it is display-only
PRODUCT: 4D | VERSION: 20 | PLATFORM: Mac & Win
Published On: April 8, 2024

When a read-only boolean data is displayed in a listbox as a checkbox, its appearance may not always be the best representation of the data. For example, the listbox shown below displays a list of students enrolled in a class.



Since the "Enrolled" column is set to non-enterable, the appearance of the checkbox column is grayed out. In some cases, this might not be the desired appearance. Since the column is for display only, the boolean column can be replaced by a text column, and the boolean value can be represented by a checkmark character instead. The following listbox is an example of how it could look with the checkmark character representing the data in the boolean field.



To accomplish this, change the "Data Type" of the column to "Text."

For a selection-based listbox, replace the column expression to:

Choose([Table]BooleanField; Char(10004); "")


For a collection-based listbox, replace the column expression to:
Choose(This.BooleanAttribute; Char(10004); "")


For an array-based listbox, the boolean array must be replaced by a text array that each true element defined by Char(10004). Here is an example code that performs this task.

ARRAY TEXT(enrolled_at; Size of array(enrolled_ab))
For ($i; 1; Size of array(enrolled_ab))
  enrolled_at{$i}:=Choose(enrolled_ab{$i}; Char(10004); "")
End for