4D Blog

Home Tips How to display a multilevel collection in different list boxes!

How to display a multilevel collection in different list boxes!

May 28, 2018

Tips New collection

Starting with 4D v17, the content of a multilevel collection can easily be displayed in different list boxes. Meaning that you can bind several list boxes to display nested details … without a single line of code! This can be achieved by simply using an object or a collection as the data source for another list box!

With the new list box collection type, the “Current item” and “Selected items” properties have been added. Keep in mind that the “Current item” property allows you to get an object, while the “Selected item” property returns a collection.

Let’s checkout a concrete example and see how we can display the results of a blood test!

Database example

What’s in?

At the first level, we have the patient’s name, the date of the exam, and the name of the doctor. Then, the results are classified by category. For each category, there is a list of tests with the result value, the min, the max, and the unit.

In terms of data structure, we have an object with some first-level attributes (i.e. firstname, lastname, etc.), as well as a collection of category objects. Then for each category object, we have a collection of test objects. To summarize:

{
  "lastname": "Beal",
  "firstname": "Estele",
  ...,
  "results": [{
    "category": "Metabolic",
    "test": [
      { "name": "Albumin", "value": ... },
      { "name": ... }]
  }, {
    "category": "Lipoprotein",
    "test": [
      { "name": "HDL", "value": ...  },
      { "name": ... }]
  }, {...}]
}

The schema below describes how the results are displayed in two list boxes beside the object input. All this … without a single line of code! In fact, all properties are defined in the form objects, the only part where some coding is needed is when loading the result. That’s it, folks! ?

 

As you can see, this example makes blood test results easier to read and understand, especially when the incorrect data is highlighted with a splash of color.

To do this, we associated the following Decorate method with the meta expression in the list box property:

If (This.value>(This.max*2))
 $0:=Form.meta.doubleOutOfRange
Else
 If ((This.value>This.max) | (This.value<This.min))
  $0:=Form.meta.outOfRange
 Else
  $0:=Form.meta.perfectValue
 End if
End if

Discuss

Tags Collections, Listbox, Objects, v17

Latest related posts

  • September 15, 2025

    Find the right spot in your 4D Write Pro document with AI

  • September 2, 2025

    Intelligent 4D Write Pro document analysis with AI

  • August 25, 2025

    ORDA – Constructor and touched event – Detailed behaviour through a network

Vanessa Talbot
Vanessa Talbot
• Product Owner •Vanessa Talbot joined 4D Program team in June, 2014. 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.Since her arrival, she has worked to define key features in 4D. She has worked on most of preemptive multi-threading new features and also on a very complex subject: the new architecture for engined application. Vanessa has a degree from Telecom Saint-Etienne. She began her career at the Criminal Research Institute as a developer for the audiovisual department. She has also worked in media and medical fields as expert in technical support, production as well as documenting new features.
  • Deutsch
  • Français
  • English
  • Português
  • Čeština
  • Español
  • Italiano
  • 日本語

Categories

Browse categories

  • AI
  • 4D View Pro
  • 4D Write Pro
  • 4D for Mobile
  • Email
  • Development Mode
  • 4D Language
  • ORDA
  • User Interface / GUI
  • Qodly Studio
  • Server
  • Maintenance
  • Deployment
  • 4D Tutorials
  • Generic
  • 4D Summit sessions and other online videos

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor

Tags

4D-Analyzer 4D AIKit 4D for Android 4D for iOS 4D NetKit 4D Qodly Pro 4D View Pro 4D Write Pro 20 R10 21 21 R2 Administration AI Artificial Intelligence Build application Class Client/Server Code editor Collections Compatibility settings Formula Listbox Logs Mail Network Objects OpenAI ORDA PDF Pictures Preemptive Programming REST Scalability Security Session Source control Speed Spreadsheet Tutorial UI User Experience vscode Web Word processor
Subscribe to 4D Newsletter

© 2026 4D SAS - All rights reserved
Terms & Conditions | Legal Notices | Data Policy | Cookie Policy | Contact us | Write for us


Subscribe to 4D Newsletter

* Your privacy is very important to us. Please click here to view our Policy

Contact us

Got a question, suggestion or just want to get in touch with the 4D bloggers? Drop us a line!

* Your privacy is very important to us. Please click here to view our Policy