Tech Tip: Simplified way to select rows in entity selection/collection based listbox
PRODUCT: 4D | VERSION: 18 R | PLATFORM: Mac & Win
Published On: May 13, 2020
Prior to v18 R3, the typical way of selecting rows in a listbox was to use the command LISTBOX SELECT ROW and to loop through each item in the listbox as shown below:
// Selects all rows in a listbox C_LONGINT($i) For ($i;1;Form.LB.length) LISTBOX SELECT ROW(*;"List Box";$i;lk add to selection) End for |
However, v18 R3 introduces the command LISTBOX SELECT ROWS which condenses everything to one line where the 3rd argument can be any collection or entity selection that you want to be selected.
LISTBOX SELECT ROWS(*;"List Box";Form.LB;lk add to selection) |
With the new command LISTBOX SELECT ROWS, there is no longer any need for excessive looping.