ORDA – Better list box row selecting

Automatically translated from English
You’ve probably used the LISTBOX SELECT ROW command many times, looping through each entity in order to select the rows for an entity selection.  4D v18 R3 simplifies the process with the new LISTBOX SELECT ROWS command.

HDI: Examples to easily select rows in a list box

entity selection List box 

The new LISTBOX SELECT ROWS command accepts an entity selection as a parameter. Rows matching the entity selection can be selected with just a single line of code. They can also easily be added to or removed from the selected rows.
 

Example

The following code creates an entity selection of cash-paying clients and selects the rows for the entity selection in a list box:

C_OBJECT($selection)
$selection:=ds.Invoices.query("payment=:1";"Cash")
LISTBOX SELECT ROWS(*;"Invoices";$selection;lk replace selection)
 
Here’s the resulting list box:

Collection List box 

The new LISTBOX SELECT ROWS command uses the same, easy principle! Simply, pass a collection containing the objects references you want to select to the command.
 

Example

The following code uses the Form.payments collection and selects the rows for clients within a specified payment range:

Using the Form.payments collection:

[
 {name:Cash,min:100,max:500},
 {name:Cheque,min:200,max:1200},
 {name:Credit card,min:700,max:1500},
 {name:Gift card,min:800,max:900}
]

 

C_COLLECTION($collection)
$collection:=Form.payments.query("min <= :1 and max >= :1";250)
LISTBOX SELECT ROWS(*;"Payments";$collection;lk replace selection)

 

The resulting list box:

Download the HDI above and check the doc center to learn more about this new command. 

Avatar

• Product Owner •

Marie-Sophie Landrieu-Yvert has joined the 4D Product team as a Product Owner in 2017. As a Product Owner, she is in charge of writing the user stories then translating it to functional specifications. Her role is also to make sure that the feature implementation delivered is meeting the customer need.

Marie-Sophie graduated from the ESIGELEC Engineering School and began her career as an engineer at IBM in 1995. She participated on various projects (maintenance or build projects) and worked as a Cobol developer. Then she worked as an UML designer and Java developer. Lately her main roles were analyzing and writing functional requirements, coordinate business and development teams.