Helping you drive digital innovation
Subscribe
RSS Feed of the Mendix Blog
Thanks for Subscribing

Keep an eye out for Mendix resources coming straight to your inbox.

Speed Up Your Microflow (Modeling)

on December 18, 2012

Share:

In addition to the major features of version 4 – mobile forms and non-persistent entities – some smaller improvements were included as well. Today we will look at how both the modeling and the execution of microflows can be speeded up in version 4.

Creating Objects

Creating objects has become much faster in version 4. The ‘create’ action no longer inserts a row into the database. Apart from the speedup, this also means that an object does not show up for other users until it is actually committed. You will no longer see empty rows resulting from objects that are still being edited.

An object can now be initialized straight from the ‘create’ action. The edit form includes a grid with changes that will be applied to the new object. For initialization, there is no need for a separate ‘change’ action anymore. Apparently this can even keep your coffee warm!

Creating and initializing an object.

Creating and initializing an object.

Committing and Deleting Multiple Objects

The ‘commit’ action can commit multiple objects at once. There is no need to create a loop and commit the objects one by one. This not only saves time while modeling but also while executing; committing multiple objects happens with a very efficient batch commit, which is much faster than the loop solution.

Committing a list of objects.

Committing a list of objects.

The ‘delete’ action has undergone the same treatment as ‘commit’: you can delete multiple objects with one ‘delete’. Again, you do not need a loop and it is much faster than the alternative.

Calling Web Services and Importing XML

Both the ‘call web service’ action and the ‘import XML’ action offer the option to store the resulting list of objects in a variable now. You no longer need to add a parameter to your mapping and associate all results with that parameter, just so you can discover the imported objects again.

Whether to commit the imported objects to the database is an option now. Also, you can limit the number of objects that are returned.

Retrieving Objects

Retrieve by association now allows following association in ‘reverse’. When retrieving from the database you can specify an offset and a limit. This allows you to iterate through huge collections of objects without running out of memory.

Find and filter

There are two new list operations: find and filter. They both look through a list for elements that have an attribute set to a given value. ‘Find’ returns the first object that matches, ‘filter’ returns all of them.

Filtering a list based on the value of an attribute.

Filtering a list based on the value of an attribute.

Batch API

The batch API in Java has been deprecated. Given the performance improvements in the standard actions you can get the same performance from microflows and Java without using the batch API.

Wrapping Up

Microflows modeled using the optimizations described above will be more concise and run faster than their counterparts in version 3. Take advantage of these new constructs and drink your coffee while it is still hot!

Tags:

Subscribe to Our Blog

Receive Mendix platform tips, tricks, and other resources straight to your inbox every two weeks.

RSS Feed of the Mendix Blog
Arjan van IJzendoorn

About Arjan van IJzendoorn

Arjan is a member of the Mendix R&D department. He started developing the Mendix Modeler a long time ago and is still working on that application most of the time. Currently, he focuses on the modeling side of pages and widgets, with the occasional excursion into the rest of the Modeler.

| Community Profile