Posts

How to: Locking in Mendix to get a unique number

Afbeelding
A few days after our flying start in Mendix, we ran into a nice Mendix challenge. We found out that Mendix doesn't have a default mechanism to lock entities. But sometimes you need it to get things done. In our case we'd like to have unique numbers. Unique for each order and unique for each organisation we have in the system. Autonumbering wiIl not work, because each organisation want to choose their own starting number. If you want to do this on the fly, you need a locking mechanism to avoid duplicate numbers. In the past there was a app store module facilitating this, but Mendix removed the support for that. Because it doesn't work well when applications are horizontally scaled. We looked for a way around and - together with Bart Luijten from Mendix - we found an interesting and easy to implement solution. It's based on the fact that a microflow waits to change an entity when this entity is changed and committed in another, parallel running microflow. How

Why we chose Mendix

A few years ago I visited a Mendix meeting. That would be the future I was told, so together with my companion I decided to take a look. Unfortunately for Mendix, but we were not particularly impressed. (I think we're talking about five or six years ago.) A nice system to generate some screens based on a database model, but that's it. You couldn't make apps with it, just web applications. And building more complex applications with external links and complex business logic was certainly not something we could have imagined. But when we did another research on low code platforms last year, we saw that Mendix had made great strides in their development. So much so that we thought: we really need to do something with this. This is really the future. It solves so many problems that you encounter with traditional development - just think of (in)stability and (non) adaptability - and it makes development so much faster, you can just do a lot more with it. To cut a long story