To display a list of records, an entity selection list box is the most suitable when using ORDA technology. 4D v18 R2 simplifies your life with a new tool to easily build entity selection list boxes: List box builder. What is it? It’s a simple dialog where you can set up your list box in a few quick steps (select the table and fields to display, enter column titles, and define the column order).
How?
In the Form editor click on the new icon to display the List box builder dialog.
Next, select a table and the fields to be displayed in the list box. The order of the fields corresponds to the order of the columns in the generated list box (you can reorder them with a simple drag and drop action).
Entity selection list boxes require an expression for the entity selection to be displayed. By default, 4D prefills the expression with “Form.currentSelection”.
Clicking on the Copy button with copy the expression with code to load the entire entity selection from the selected table. The following example shows the clipboard contents of the prefilled expression and the additional code:
Form.currentSelection:=ds.Contact.all()
One last click on the Build widget button and voilà! The entity selection list box is generated. Let’s add a button and paste the clipboard contents into the button’s object method.
A live demonstration
In this demonstration video, we’ll use the “Contacts” database. The video shows two examples. In the first example, we create a form with an entity selection list box to display everyone in the “Contact” table.
In the second example, we create two list boxes: “Category” and “Contact”. When a user clicks on a category, the list of contacts for this category is displayed in the second list box.