# Value List

## Overview

A **value list** is an object from the data layer that is used by the UI (components) to provide selection lists and translations of internal values to display values.\
Value lists can be static, meaning their contents do not change, or dynamic, where they can be updated or modified over time.

They can be used for example in components such as dropdown menus, radio button groups or checkbox lists.

## Properties Summarized

| Type                                                       | Name                                        | Summary                                                                                                                                                                    |
| ---------------------------------------------------------- | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [addEmptyValue](#addemptyvalue)             | Property that tells if an empty value must be shown next to the items in the value list.                                                                                   |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [comment](#comment)                         | Additional design time information, such as programmer notes about this model object's purpose.                                                                            |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [customValues](#customvalues)               | A string with the elements in the valuelist.                                                                                                                               |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [dataProviderID1](#dataproviderid1)         | This is the dataprovider selected in the first list of dataproviders, when a table or related valuelist is selected.                                                       |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [dataProviderID2](#dataproviderid2)         | This is the dataprovider selected in the second list of dataproviders, when a table or related valuelist is selected.                                                      |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [dataProviderID3](#dataproviderid3)         | This is the dataprovider selected in the third list of dataproviders, when a table or related valuelist is selected.                                                       |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [dataSource](#datasource)                   | Compact representation of the names of the server and table that are used for loading the data from the database.                                                          |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [deprecated](#deprecated)                   | Gets the deprecation info for this element.                                                                                                                                |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [displayValueType](#displayvaluetype)       | The type of the display value if this is a global or custom valuelist, servoy needs to know this for formatting purposes.                                                  |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [encapsulation](#encapsulation)             | The encapsulation mode of this Valuelist.                                                                                                                                  |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [fallbackValueList](#fallbackvaluelist)     | If the valuelist only displays the "active" values that a user can choose, but you still need to be able to show also old values, then a fallback valuelist should be set. |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) | [lazyLoading](#lazyloading)                 | A property, specific for NG & Titanium clients with GlobalValuelist - it helps to query/call the global valuelist method only when it is needed.                           |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [name](#name)                               | The name of the value list.                                                                                                                                                |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [realValueType](#realvaluetype)             | The type of the real value if this is a global or custom valuelist, servoy needs to know this so it can check if the types match on the record it is binded to.            |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [relationName](#relationname)               | The name of the relation that is used for loading data from the database.                                                                                                  |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [returnDataProviders](#returndataproviders) | Which of the dataprovers should be used as the return dataprovider, so set back into the records dataprovider.                                                             |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [separator](#separator)                     | A String representing the separator that should be used when multiple display dataproviders are set, when the value list has the type set to database values.              |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [showDataProviders](#showdataproviders)     | Gets the showDataProvider.                                                                                                                                                 |
| [String](/reference/servoycore/dev-api/js-lib/string.md)   | [sortOptions](#sortoptions)                 | Sort options that are applied when the valuelist loads its data from the database.                                                                                         |
| [Boolean](/reference/servoycore/dev-api/js-lib/boolean.md) | [useTableFilter](#usetablefilter)           | Flag that tells if the name of the valuelist should be applied as a filter on the 'valuelist\_name' column when retrieving the data from the database.                     |
| [Number](/reference/servoycore/dev-api/js-lib/number.md)   | [valueListType](#valuelisttype)             | The type of the valuelist.                                                                                                                                                 |

## Properties Detailed

### addEmptyValue

Property that tells if an empty value must be shown next to the items in the value list.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

### comment

Additional design time information, such as programmer notes about this model object's purpose.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

### customValues

A string with the elements in the valuelist. The elements can be separated by line feeds:\
custom1\
custom2

Elements can optionally have real values:\
custom1|1\
custom2|2

The (custom) values can be given via a global scope method instead, if the valuelist type is of global method type...

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
Yes|1
No|2
Don't know|3
```

### dataProviderID1

This is the dataprovider selected in the first list of dataproviders, when a table or related valuelist is selected.\
This dataprovider can be marked as a display and/or a return value.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) Returns a String

**Sample**

```js
"companyname"
```

### dataProviderID2

This is the dataprovider selected in the second list of dataproviders, when a table or related valuelist is selected.\
This dataprovider can be marked as a display and/or a return value.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) Returns a String

**Sample**

```js
"customerid"
```

### dataProviderID3

This is the dataprovider selected in the third list of dataproviders, when a table or related valuelist is selected.\
This dataprovider can be marked as a display and/or a return value.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) Returns a String

**Sample**

```js
"contactname"
```

### dataSource

Compact representation of the names of the server and table that are used for loading the data from the database.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
"example_data.customers"
```

### deprecated

Gets the deprecation info for this element.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) the deprecation info for this object or null if it is not deprecated

**Sample**

```js
"not used anymore, replaced with ..."
```

### displayValueType

The type of the display value if this is a global or custom valuelist, servoy needs to know this for formatting purposes.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
"TEXT"
```

### encapsulation

The encapsulation mode of this Valuelist. The following can be used:

* Public (available in both scripting and designer from any module)
* Module Scope - available in both scripting and designer but only in the same module.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md) the encapsulation mode/level of the persist.

**Sample**

```js
"Public"
```

### fallbackValueList

If the valuelist only displays the "active" values that a user can choose, but you still need to be able to show also old values, then a fallback valuelist should be set.\
It works as a backup list for getting a display value for a real value that is not in this normal/main valuelist anymore.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md) the valueback valuelist id.

**Sample**

```js
"customers_and_company_name"
```

### lazyLoading

A property, specific for NG & Titanium clients with GlobalValuelist - it helps to query/call the global valuelist method only when it is needed.

This flag has to be set both on the valuelist and in component specification (.spec file), on the valuelist property, in order for it to work correctly (so the developer decides if a valuelist provides this option, and the component decides if it uses this feature or not).

IMPORTANT: Usage of real & display values is not fully supported with lazy loading. Don't set lazy load if your method returns both real and display values. This limitation is in place because, very likely in that case, we do need directly the display value for the current component's data (real value) in order to display it in UI...

**Type**\
[Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)

### name

The name of the value list.

It is relevant when the "useTableFilter" property is set.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

### realValueType

The type of the real value if this is a global or custom valuelist, servoy needs to know this so it can check if the types match on the record it is binded to.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

**Sample**

```js
"TEXT"
```

### relationName

The name of the relation that is used for loading data from the database.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
"orders_to_order_details"
```

### returnDataProviders

Which of the dataprovers should be used as the return dataprovider, so set back into the records dataprovider.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md) Returns a int

### separator

A String representing the separator that should be used when multiple display dataproviders are set, when the value list has the type set to database values.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
" / "
```

### showDataProviders

Gets the showDataProvider.

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md) Returns a int

### sortOptions

Sort options that are applied when the valuelist loads its data from the database.

**Type**\
[String](/reference/servoycore/dev-api/js-lib/string.md)

**Sample**

```js
"companyname asc"
```

### useTableFilter

Flag that tells if the name of the valuelist should be applied as a filter on the 'valuelist\_name' column when retrieving the data from the database.

**Type**\
[Boolean](/reference/servoycore/dev-api/js-lib/boolean.md)

### valueListType

The type of the valuelist.\
Can be one of:

* custom values
* global method
* database values
* table based
* relation based

**Type**\
[Number](/reference/servoycore/dev-api/js-lib/number.md)

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.servoy.com/reference/servoycore/object-model/solution/valuelist.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
