KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Updating listbox entity selection columns upon data change
PRODUCT: 4D | VERSION: 17 | PLATFORM: Mac & Win
Published On: November 29, 2018
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

Entity selection listboxes works slightly different than current seletion listboxes regarding automatically updated columns. For example, the current selection listbox below displays columns for the first name, last name, and full name where the full name column is dependent on the first name and last name columns. If the first name or last name were editted and updated with a new value, the full name column would also update based on its new value. In the example below, the first name is updated from "Tim" to "Tommy" and the change is reflected in the Full Name column.

Current Selection Listbox - Before First Name column update


Current Selection Listbox - After First Name column update


However, entity selection listboxes will not automatically update other columns after data change. With the same example, the first name column is changed from "Tim" to "Tommy", yet the full name column still displays "Tim" as shown below.

Entity Selection Listbox - Incorrect column update


In order to update all other columns based on data change, the entity selection variable assigned to the listbox can be assigned to itself within the On Data Change listbox event. With this implementation, the internal modification flag is incremented and the listbox will update accordingly to the next sync event.

Entity Selection Listbox - Assigned to Form.LB


Case of
   // Assign entity selection reference to itself
   : (Form event=On Data Change)
   Form.LB:=Form.LB
  
End case


Entity Selection Listbox - Corrected column update

Commented by Manuel PIQUET on November 30, 2018 at 2:16 AM
There is a bug if you have filled both "Current item" and "Selected Items" (see ACI0098644 and master bug ACI0098483) this won't works.