Last update: Edit

1 Introduction

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

When running the application on SAP Cloud Platform 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.

For other cloud environments – for example, IBM Cloud or MindSphere – 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 Free App environment, the values defined in Studio Pro are used.

Constants can be used in the following:

  • 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

2 Common Properties

2.1 Name

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

2.2 Documentation

This field is for documentation purposes only: end-users will never see it, and it does not influence the behavior of your application

3 Type Properties

3.1 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, decimal, and integer/long.

4 Value Properties

4.1 Default Value

This property is the default value of the constant. This value is used when running locally or in a Free App environment. When running locally, the value can be overridden in the currently selected configuration.

4.2 Exposed to Client

This property defines whether the constant is accessible from client-side expressions (expressions in nanoflows and pages).

Option Description
Yes The constant will be sent to the client and will be accessible from client-side expressions
No (default) The constant will not be sent to the client and will be only accessible from microflow expressions