A wide range of possibilities to manage your collections

4D v16 R6 provides advanced capabilities to manipulate collections, thanks to a series of methods to be used with Object Notation. Over 40 methods are now available, which allow, for example, the ability to add or remove elements in a collection, sort it, search the elements in it and much more! There are so many new possibilities that it is impossible to present them in a single post. This post is the first of a series you don’t want to miss…

How to call Collection methods?

A method associated to a collection is only accessible with Object Notation, thus it’s provided as a preview in 4D v16 R6 . The following example gives you some insight into what the code looks like . For instance, here’s how the push method allows you to add elements to the $col collection.

$col.push(10;100) // Add 10 and 100 to the collection
$s:=$col.sum() // Sum of all the elements of the collection
$r:=$col.pop() // Read and remove the last element

a Vast list of manipulations

To learn all the details about each method, take a look at the “collections” chapter from the language manual.


For a smooth migration to collections, two new commands, COLLECTION TO ARRAY and ARRAY TO COLLECTION, have been created to help you to write new code alongside your existing code, and easily make them work together!

what’s next?

OK, it was a quite general post, but we had to give you the big picture before going further. The next blog post will go into more detail and demonstrate multiple ways to insert or remove elements from a collection.

Fabrice Mainguené
• Product Owner •Fabrice Mainguené joined 4D Program team in November, 2016. As a Product Owner, he is in charge of writing the user stories then translating it to functional specifications. His role is also to make sure that the feature implementation delivered is meeting the customer need.After obtaining a Bachelor degree in Computer Science at CNAM, Fabrice joined a small software publishing company as a Windev developer. Then he worked for different companies in industry and trade areas as a Windev and web developer as well as technical advisor on new features.