Make model info available in expressions (static model reflection) - Mendix Forum

Make model info available in expressions (static model reflection)

18

In some cases I've seen that it would be very convenient to have access to model information from an expression. All this already is accessible from the com.mendix.systemwideinterfaces.core.meta package of the server API and from the mendix/lib/MxMetaObject class in the client API, but is not directly usable from the modeler. I guess you could name my idea 'static model reflection' and partly see it as an addition to the MxModelReflection module for the cases you don't need to store this persistently. In the examples below I'm using the fictive '~'  prefix to illustrate how this could look like.

Examples:

 ~name - available from any item like a microflow, an enity, an attribute, etc.

 ~moduleName -  available from any item

 ~isSpecialization - available from object  ($myObject~isSpecialization)

 ~isPersistable - available from object  ($myObject~isPersistable)


Also, it would be great to have access to your model through non-persistent entities in the System module (or a seperate one). Again, in addition to the persistent MxModelReflection.

asked
9 answers

Thanks for your comments Pim and Ryan! Glad to hear you appreciate the idea.

Created

It would be so great to be able to catch certain edge cases like this at compile / build time. It’s on our backlog to utilize the Model SDK to catch DeepLink issues with constants that drift over-time, but it would be great to avoid doing all of that work and catching it right in the modeler.

The Mendix platform is very powerful, but it feels so strange to have to embed values in constants that should just be identifiable by the modeler itself. That and having to generate / sync reflection at runtime feel like pretty large workarounds.

Created

Almost 2 years ago but I still miss this feature in the platform. I think is so easy to implement with for example:
$NewCustomer/metamodel/CustomerName 

Created

Also for better validation possibilities would be awesome to pass names of attributes and associations to for example a java-action. 

so if there can be a function in Microflow expressions like getName(<object> or <object/attribute> or <object/association>) like it's also available for enums with GetCaption(<enum>)

Created

After another year of developing, I still would like to see this implemented in a future Mendix Studio version.

Things I wouldn't have to do anymore:

  • Creating Constants with the name of the module in all my modules.
  • Creating (complex) Inheritance splits where a simple ‘is specialization’ check would be sufficient.
  • Using Constants or the Model Reflection module to specify names of model objects in my technical log messages (like microflows, entities, attributes and associations).
  • Use the Model Reflection module at all if there would be a System (and always up-to-date) Model Reflection module in your project by default.
Created

+1 duplicate idea here: https://forum.mendix.com/link/ideas/683 

Created

Thanks for the use case examples, Fabian!

Other cases could be:

  • Log messages
    • Use the name of the current module as log node
    • Specify the name of the microflow, entity type and/or attribute in the message
  • Exclusive splits bases on model information, like if an object is persistent or not
Created

Nice idea, some use cases from me (which mainly avoid issues from refactoring and simplify the use of model reflection)

  • defining modules that need to be synced in model reflection in a configuration microflow. (currently you would have to name it by a static string or use another workaround
  • Specificying microflows to be run as a separate process (currently this can only be done on a java action)
  • Any java action that has an attribute name as parameter.

 

Created

Interesting! Can you provide some use cases?

Created