Constant in Mendix like global variable

0
How can we create a constant and set the value of constant and then  use it in UI for visibility?  
asked
3 answers
0

See the info abouts constants: https://docs.mendix.com/refguide/constants#4-2-exposed-to-client

With the expose to client option you can use it in page expressions or nanoflows

answered
0

while creating the constant the default value is the value you set to constant

and it will be available if you “on”expose it to the client as mentioned by Maarten

added a snap for refernce

answered
0

In addition to the answer of Maarten.

Personally, I’m using constant for those reasons:

  • Set the constant one time it will never change
  • More readability, because you can name your constant properly
  • If you need environment specific values. For example, if you want to call a test API on your acceptance environment. In production, you also want to do that call, but to the production API.
     

In case of your question, you want to set a constant and show in the UI. For example for an application name or application version number, it’s OK. To do something user specific or data specific, I think you need to use variables.

answered