Create App Context
App Context
App Context Variables helps in managing and storing application-level data that needs to be accessed globally across interfaces, master layouts, components, events, subscriptions, and services. They help maintain application state, enabling seamless data sharing and consistency throughout the UI.
The app context variables can be available to use in the expression builder and widget’s bindings.
An asterisk (*) denotes that the property is mandatory for creating the AppContext.
The "AppContext property created successfully" message displays upon successful creation.
Use Case
- Storing app-wide settings.
- Sharing data between unrelated components (interfaces, master layouts, components etc.)
Basic App Context Variable Configuration
- Name Field
- Is Array
-
Defines whether the property is an array or a single value.
-
Options
-
Yes: Defines the property as an array.
-
No: Defines it as a single value.
-
Behaviour
-
When Is Array = Yes, the Initialize as New Object field becomes visible.
-
When Is Array = No, the Default Value field appears for primitive types only.
- Data Type Selection
-
Type
-
Defines the data type of the property.
-
Options include:
-
Any: Accepts any type of value.
-
Service or Db entities: Represents a custom complex entity.
-
Map: Defines a key-value collection.
-
Primitive Types: String, Integer, Double, Long, Boolean, and Date Time.
- Default Value Configuration
-
The Default Value field is only visible when:
-
The Is Array field is set to No.
-
The selected type is primitive (e.g., String, Integer, Double, Long, Boolean, DateTime).
-
It is NOT visible when:
-
The type is Any.
-
The type is Map.
-
Is Array = Yes.
-
A complex type is selected.
-
Default Value Controls:
-
Boolean: Dropdown with True and False options.
-
String: Textbox for string input.
-
Integer, Double, Long: Numeric textbox.
-
DateTime: Two options:
-
Fixed: Displays a calendar for date selection.
-
Current: Uses the current date and time.
- Map Configuration When the Map type is selected, additional fields appear:
-
Key Type:
-
Specifies the data type of the map's keys.
-
Supports all primitive types.
-
Value Type:
-
Defines the data type of the map's values.
-
Supports both primitive and complex types.
-
Map types are not allowed as value types.
-
Is Array (for Value Type):
-
Determines if the value type should be an array.
-
The Is Array checkbox controls the array status of the value type only.
-
Behaviour:
-
The Default Value field is NOT visible when the Map type is selected.
- Object Initialization
-
Initialize As New Object:
-
Specifies whether the App Context Variable should be initialized as a new object by default.
-
Visible for:
-
Complex types.
-
Map types.
-
Primitive types when Is Array = Yes.
-
Options:
-
Yes: Initializes the App Context Variable as a new object.
-
No: Does not auto-initialize.
Create an App Context Variable
Follow the below steps to create an App Context Variable:
- From the explorer menu, right-click on App Context and select Add.
- In the popup window, configure the properties as required and then click Save.
| Property | Description | Comments |
|---|---|---|
| Basic Configuration | ||
| App Context Variable Name | Provide the name for the property. | Name must start with a character followed by alphanumeric or ''. No spaces are allowed. Except underscore (), no other special characters are allowed. Name cannot start with a number. |
| Is Array | Specify whether the App Context Variable is an array. Either Yes or No. | Default set to No. |
| Data Type* | Specify the data type of the App Context Variable. | By default, it is set to No. |
| Default value | Provide default value. | |
| Key Type | Select the data type for the key type. | Supports only primitive types |
| Value Type | Select the data type for the value type. | Supports primitive, complex except map type. |
| Is Array | Select the check box for the value type to be an array. |
An asterisk (*) denotes a mandatory property.
The "AppContext property created successfully" message displays upon successful creation.