List Boxes: Time Columns and Footer Calculation!

List boxes are great, powerful tools to display data in the interface. They can display fields from records, items from arrays, and since recently, entity selections and collections

While the new list boxes using collections or entity selections are more powerful in many ways, they did not allow time display and automatic calculations in their footers, unlike list boxes displaying arrays or records.

From now on, and as long as you use project mode, all types of list boxes can display hours in their columns, but also have the possibility to display calculations on their footers.

HDI Time columns and footer calculation

Time display

Until now, there was no simple way to display hours (or durations) in the list boxes’ columns that contain collections or entity selections. In fact, as this type of data is stored in numerical form, you had to format it to make it readable. It was possible (and not complicated) to do that, but the drawback was that the data would then be read-only, it could no longer be edited.

Those days are over. Direct formatting as time is now possible directly through the list of properties, and can even be done by programming to determine the type of the desired format.

Calculation of column Footer

The functions to automatically calculate sums, averages, etc. in the footer have been extended to collections and entity selections. This means that you no longer need to call up methods or functions to perform these calculations. 4D will take care of it for you. Also, this can be defined at the property list level or by programming, depending on your needs.

A small detail…

Unlike tables or record selections, columns based on collections or entity selections can contain null values (NULL). It’s important to know that in calculations, these values are never taken into account, be it for sums, averages, min or max, or even sums.

Time for A Demo

The provided example may seem “déjà vu” to some of you; it’s a database dating from version 13 that has been easily converted and then enhanced with two new pages dealing with collections and entity selections.

Good programming and good list boxes. Have fun!

 

Roland Lannuzel
• Product Owner & 4D Expert •After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.