Mendix 7 is no longer supported unless you have Extended Support (for details, please contact Mendix Support). Mendix 7 documentation will remain available for customers with Extended Support until July, 2024.

Constants

Last modified: August 4, 2023

Constants are used to define configuration values. These can differ per environment.

When running the application on SAP BTP, or a licensed Mendix Cloud environment, you can configure each environment separately using the Model Options tab of the Environment Details page to set your constants. See Environment Details for more information.

For other cloud environments, for example, Insights Hub, the constants can be accessed as Environment Variables in, for instance, Cloud Foundry. The constant is exposed with the name module + . + constant. For example mymodule.myconstant.

When running the application locally or in a sandbox, the values defined in the Modeler are used.

Constants can be used in:

  • Microflow expressions: by prefixing the full name of the constant with @.
  • Consumed Web Services: in this case the constant is a URL that specifies where the web service is located. This can vary based on the environment in which the application is running, so that you can for example use different web services for development and production.

Common Properties

Name

The name of the constant. This name is used to refer to it.

Documentation

This field is for documentation purpose only: end users will never see it, and it doesn’t influence the behavior of your application.

Type Properties

Type

The data type of the constant. This determines what kind of values a constant can hold. Supported data types are String, Boolean, Date and time, Float (deprecated), Decimal and Integer/Long.

Value Properties

Default value

The default value of the constant. This value is used when running locally or in a sandbox. When running locally, the value can be overridden in the currently selected Configuration.