Support for Primitive Types in Snippet Parameters - Mendix Forum

Support for Primitive Types in Snippet Parameters

3

Snippet parameters do not support primitive types, making it impossible to directly pass simple values such as String, Boolean, Integer, Decimal, Date and Time, and Enumeration to Snippets.

Since Snippets are used as reusable UI components, there are cases where we want to pass simple configuration values from the caller, such as:

* Passing titles and labels as Strings

* Switching between reference mode and edit mode using Boolean

* Controlling the visibility of buttons and sections using Boolean

* Switching display mode using Enumeration

* Passing counts and thresholds as Integer/Decimal


The workaround is to create an auxiliary entity that holds these values as attributes and pass that objects as Snippet parameters.

However, this requires creating an auxiliary entity solely for simple UI configuration, making the design and implementation cumbersome.

Page parameters can handle primitive types, we would like Snippet parameters to be able to handle primitive types as well.


asked
1 answers

Hello Seishi,


I recently tried to use a snippet for a tabbed container and wanted to add a constraint based on the employee name (User). In my overview tab, when the current employee name (string) is provided as a snippet parameter or object, the snippet displays constrained data based by employee. On the other tab, when the employee name (string) or object is empty, it behaves differently. However, I was unable to pass the name or an empty object since it is not available.


Best regards,

Maxim H.

Intermediate Mendix Maker

Who feels for you

Created