Introducing Mendix 7.1.0

The Mendix 7.1.0 release brings two new shiny features: expressions in conditional visibility and editability, and the possibility to show what custom widgets actually look like in the Mendix Modeler. Both are detailed in this post. Enjoy!

Expressive Conditional Visibility and Editability

Conditional visibility and editability are very useful to create dynamic pages, but previously you could only use it with Boolean or Enumeration attributes. We received many requests to extend it to other attribute types. We thought we could do better and made it possible to do conditional visibility and editability based on arbitrary microflow expressions. No more superfluous virtual attributes in your entities, only to show or hide some widget. Instead, just enter an expression resulting in a Boolean. Better yet, these expressions run in the browser, so they are fast and can be used offline as well!

For example, imagine an application in which results of course examinations can be registered and viewed. If a student attains more than 75 points, we would like to show a “checkmark”, otherwise an “x”. Previously, to achieve this, you would have to introduce a virtual attribute which would compute the value or a Boolean attribute which stores this value. Either approach would contaminate the domain model, which is not desirable. Now that expressions can be used for conditional visibility we can do this differently.

The application uses a default template grid which shows the name of the course, the number of points attained by the student and the result as an image based on the number of attained points.

Both images are conditionally visible based on an expression. The “checkmark” image is shown when the expression “$currentObject/AttainedPoints >= 75” is true. This means the student has successfully completed the course.

The “$currentObject” variable refers to the object which is in scope for the widget on which the conditional visibility is defined. In this case, that’s the course object in the template grid. For the “x” image the condition “$currentObject/Attained < 75” is defined. This means the student should make another attempt to complete this course.

For your convenience, easy access to the options of always showing the widget or showing it based on a Boolean or Enumeration attribute without having to type an expression are still available.

The above configuration leads the following result in the actual application.

This student successfully completed all of the “Beginner” courses, but still needs to retry one “Intermediate” and one “Advanced” course. This overview makes it really easy to see this and you can model this without needing any special attributes in your domain model!

Now that we have brought expressions to the client, there are other places where we can use them as well. In addition, the supported functions will be expanded. You can use the auto-completion feature in the expression editor to find out what’s currently being supported.

Stay tuned for more expression goodness in the near future!

Grey Boxes…Be Gone!

Don’t you hate those grey boxes filling your projects when you use fancy custom widgets? See, for example, how the ChartJS widget is rendered by default in the Mendix Modeler.

Now there is a way out: custom widget developers can now add preview images to their widgets. You can do this by adding a file named “preview.jpg” or “preview.png” in the widget folder of the widget package. Let the modeler show a beautiful button or a fancy graph. Or a cat.