Skip to main content

List of Values

Where it lives
JSON Pointer: /listOfValues
JSONPath: $.listOfValues
Parent: Root of the metadata file

Overview

List of Values (LOV) are used to define a set of predefined values that can be used in various parts of the SolidX application, such as dropdowns or selection fields. This helps ensure data consistency and improve user experience.

Example: List of Values Metadata

Below is an example wherein we define several list of values for different types such as INDUSTRY and REGULATED_BY.

List of Values Schema
{
..., // Other metadata sections
"listOfValues": [
{
"type": "INDUSTRY",
"value": "Healthcare",
"display": "Healthcare",
"description": "Industry Healthcare list of value",
"default": false,
"sequence": 4,
"moduleUserKey": "<MODULE_USER_KEY>"
},
{
"type": "INDUSTRY",
"value": "Information Technology",
"display": "Information Technology",
"description": "Industry Information Technology list of value",
"default": false,
"sequence": 3,
"moduleUserKey": "<MODULE_USER_KEY>"
},
{
"type": "REGULATED_BY",
"value": "FCA",
"display": "FCA",
"description": "Regulated by FCA list of value",
"default": false,
"sequence": 6,
"moduleUserKey": "<MODULE_USER_KEY>"
}
]
}

Using the List of Values in Dynamic Selection Fields

To use the defined list of values in your application, you need to reference them by creating a dynamic selection field in your model.

To utilize the defined list of values in a dynamic selection field, you can configure a field in your model to reference the LOV using the ListOfValuesSelectionProvider. Below is an example of how to set up a dynamic selection field that pulls values from the REGULATED_BY type in the LOV.

{
"moduleMetadata": {
..., // Module metadata
"models": [ // Model metadata array
{ // Institute model metadata
"singularName": "institute",
..., // Other model attributes
"fields": [ // Institute model fields metadata
..., // Other fields
{ // Regulated By field metadata
"name": "regulatedBy",
"displayName": "Regulated By",
"description": "Regulated By",
"type": "selectionDynamic",
"ormType": "varchar",
"isSystem": false,
"selectionDynamicProvider": "ListOfValuesSelectionProvider",
"selectionDynamicProviderCtxt": "{\"type\": \"REGULATED_BY\"}",
"selectionValueType": "string",
"required": false,
"unique": false,
"index": false,
"private": false,
"encrypt": false,
"encryptionType": null,
"decryptWhen": null,
"columnName": null,
"isUserKey": false,
"enableAuditTracking": true,
"isMultiSelect": true
}
]
}
]
}
}

Info

ListOfValuesSelectionProvider is a built-in selection provider that fetches values from the listOfValues metadata based on the specified type. The selectionDynamicProviderCtxt contains a JSON string with the type key to filter the LOV entries.

Further Reference

List of Values Metadata Attributes

type (string, required)

Type/category of the list of values (e.g., INDUSTRY, COUNTRY, STATUS).

value (string, required)

The actual value stored in the database.

display (string, required)

The display name shown to users in the UI.

description (string, required)

A brief description of the list of value.

default (boolean, optional, default: false)

Indicates if this value is the default selection.

sequence (number, optional)

Defines the order in which the values are displayed.

moduleUserKey (string, optional)

The user key of the module to which this list of values is associated. This helps in scoping the LOV to a specific module.