We know that sometimes you want to change the properties of multiple methods without having to open the property dialog for each method.
For example, you want to set all methods to “Can be run in preemptive mode” status, then compile your database. So with compilation errors, you get an overview of the methods to modify to be preemptive.
Using the METHOD GET NAMES command to retrieve the list of methods from your database, and then using the METHOD SET ATTRIBUTES command to modify the attributes, lets you modify them all at the same time!
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.
Like many other programming languages, 4D provides the ability to iterate over numbers with a For(…) / End for statement, or over a condition thanks to the While(…)/End while and Repeat/Until(…) keywords. These iterations (or loops) are very useful, but not the most appropriate way to iterate over advanced data types such as collections and entity selections. That’s why the new For each(…)/End for each iterator has been created, to help ease your coding!
Recently, 4D introduced of a new type of variable: collections, as well as a large set of methods to manipulate them. With 4D v17, the possibilities of collections is becoming larger by being able to easily display the content of a collection. How? List boxes of collection type!
As a developer, you often need to know whether a specified item already exists in a collection, or to find all the items corresponding to particular criteria. 4D collection methods offer many different ways to look up specific items.
Simplicity is the ultimate sophistication, and with over 40 methods in 4D v16 R6 to manage collections, things are getting much easier for you as a developer. Not only is your code clean and more readable, but its also written in record time!
Remember the days when you had to use nested loops and conditional statements to retrieve an object’s attribute? So you ended up with a long and complicated piece of code? Well, those days are over! Thanks to object notation combined with collections and their methods, you’re now able to write code faster, and in a more readable way!
Finding a specific attribute’s value has never been easier. Let’s take a look at a real life scenario and discover how!
Calculate average, total or price (including tax) are common tasks in any business application. Collections are an easy way to aggregate your data in a consistent way. With it, this type of calculation becomes very simple, because there are collection methods that do everything for you!
4D v16 R6 opens a wide range of possibilities to manage collections. Merging two collections into one, cloning or just ordering a collection is as easy as calling a method. It saves valuable time, for example, when you need to concatenate two collections, keep only the distinct values, or sort it.
4D v16 R6 provides advanced capabilities to manipulate collections, thanks to 40+ methods to be used with Object Notation. By using them, you’ll be able to write your code in a more efficient way. New code is great, but we also kept in mind that this new code needs to easily integrate with your existing code. This is why we’ve introduced dedicated commands to convert collections to arrays or strings, and vice-versa.
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