> For the complete documentation index, see [llms.txt](https://docs.eximee.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/2-pola-wyboru/wybor-rachunku-accountselector.md).

# Account selection - AccountSelector

{% hint style="info" %}
The availability of the functionality depends on the license and may not be available in all deployments.
{% endhint %}

The account selection component allows you to choose an account from a drop-down list. Each item can have descriptions shown separately in two rows. In addition, the component supports grouping the items displayed on the list.

![](https://2112972046-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F2CssJT0zIo4SJQLbSZ6l%2Fuploads%2Fgit-blob-a9d818da76ba5ebbe55788e763a6af58286ed018%2FaccountSelector.png?alt=media)

✅ **When to use:**

* Selecting an account from a drop-down list where items have an additional description, account number, balance, or grouping.

:x: **When not to use:**

* A selection of a single option without additional data is sufficient. **Use**: [Radio](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/2-pola-wyboru/radio.md) / [Tile](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/2-pola-wyboru/kafel-tile.md) / [Combobox](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/2-pola-wyboru/pole-wyboru-wartosci-z-listy-combobox.md).

## Component properties

| Eximee Designer property                         | Attribute name in the Source | Description                                                                                                                                           |
| ------------------------------------------------ | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Field placeholder** (section **Data quality**) | placeholderText              | Text visible in the field before any value is selected.                                                                                               |
| **Empty option**                                 | emptyOption                  | Property added directly to the source. Value `true` displays the first item from the list; value `false` displays the placeholder (e.g. "Select..."). |

> More information about component properties: [Common component properties](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/praca-z-komponentami-bazowymi/wspolne-wlasciwosci-komponentow.md)

## Component input parameters

| Parameter name        | Description                                                                                                             |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| **iconUrl**           | URL to the icon/photo displayed next to the item on the list (Eximee server resources).                                 |
| **text**              | Main label (description) of the item on the list.                                                                       |
| **description**       | Additional description of the item, e.g. account number or detailed information (supports text or boolean values).      |
| **suffix**            | Short additional description displayed at the end of the item, e.g. amount or currency.                                 |
| **groupId**           | Group identifier. Items with the same ID are grouped and sorted alphabetically within the section.                      |
| **group**             | Flag indicating whether the grouped variant should be presented (`true`/`false`).                                       |
| **ellipsis**          | Determines whether `description` should be shortened to one line (`true`/`false`).                                      |
| **ellipsisText**      | Determines whether `text` should be shortened to one line. By default `true`. Setting `suffix` forces the value `true`. |
| **singleAccountList** | Information whether to present a single account list view (`true`/`false`).                                             |
| **shortAccountList**  | Information whether to present a shortened version of the account list (`true`/`false`).                                |

## Component variants

![Figure 1. Component with account names only](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/iFerW96MOtF1gmDGLBBL/12_files/image2020-10-7_15-59-47.png)

![Figure 2. Component with additional description](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/tYyWFwwhFTRlYIOV8HqM/12_files/image2020-10-7_16-0-16.png)

![Figure 3. Component with additional description and sections](https://content.gitbook.com/content/2CssJT0zIo4SJQLbSZ6l/blobs/QlJzxtg4ImJkeN9YE3Xz/12_files/image2020-10-7_16-0-56.png)

## Component state information

Unlike most selection components, AccountSelector stores the value as a JSON object containing all data of the selected item.

After selecting a specific option, the component takes the value in the following format:

```
[{
    "suffix":"(14 731,21 PLN)",
    "description":"83 1123 1023 0000 2613 9510 0000",
    "groupId":"Accounts",
    "text":"Zero account",
    "value":"4"
}]
```

## Referencing the selected value

It is possible to search for specific text fragments using the `indexOf()`.

For the example component value shown above, the condition:

```
getValue("GesAccountSelector1").indexOf('"value":"4"') != -1
```

will return:

* `true` - if the account with value `4`,
* `false` - if another item was selected.

{% hint style="info" %}
The method `indexOf()` returns the position of the found text or `-1`, if the indicated fragment does not occur in the component value.
{% endhint %}

This may be useful when the visibility of another component should depend on the selected account.

Example of a visibility condition hiding the component for the account with value `4`:

```
getValue("GesAccountSelector1").indexOf('"value":"4"') == -1
```

In a similar way, other object properties can be referenced, e.g. `text`, `description`, `suffix` or `groupId`.

## Data model

The account data selected in the Account Selection component is saved in the data model. In the field **Data model key** you should indicate [multiple node](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/model-danych/struktura-modelu-danych.md#strukturamodeludanychbudowanieiuzywanie-definiowanietablicowychpolmodeludanych) with unlimited cardinality, e.g. `1..null`. The selected account goes to the item `[0]` of this node, and subsequent selected accounts to items `[1]`, `[2]` etc. Under the node you should create fields to be stored:

| Field           | What it contains                                                     |
| --------------- | -------------------------------------------------------------------- |
| **value**       | Account identifier. The field is required.                           |
| **text**        | Main account label.                                                  |
| **description** | Additional account description, e.g. account number.                 |
| **suffix**      | Short description at the end of the item, e.g. balance and currency. |
| **groupId**     | Identifier of the group to which the account belongs.                |
| **iconUrl**     | Address of the icon displayed next to the account.                   |

Fields other than `value` are optional – more information in [Data model on the interface](https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/praca-z-komponentami-bazowymi/model-danych-na-interfejsie.md#komponenty-o-wartosci-zlozonej). When the form opens, the selected account is read from the fields saved in the model.

Example: in the component **Data model key** `accounts`, and under this node fields `value`, `text` and `description`:

```
accounts (1..null)
├── value
├── text
└── description
```

The user selects the account shown in the "Component state information" section. After saving the application, the model contains:

```
accounts[0].value = 4
accounts[0].text = Zero account
accounts[0].description = 83 1123 1023 0000 2613 9510 0000
```

Balance (`suffix`) and group (`groupId`) do not have fields in the model, so they do not go into the data model.

{% hint style="warning" %}
If any field has been created under the node, you must also create the `value`field. Without it, the form will report an error when opening.

The data model key must point to a multiple node. If it points to a single field, the account is not saved in the model.
{% endhint %}

## Populating the component with values

To populate the component with data in the low-code model, you need to configure an External Data Source (EDS). Below is an example returning a list of accounts:

```js
function callService(context) {
    // Retrieve context parameters (optional)
    const showSuffix = context.getFirstParameter("showSuffix") === "true";

    return [
        {
            "value": "1",
            "text": "Zero account",
            "description": "83 1123 1023 0000 2613 9510 0000",
            "suffix": showSuffix ? "(14 731,21 PLN)" : null,
            "groupId": "Personal accounts",
            "iconUrl": "/assets/icons/account_active.png",
            "ellipsis": true
        },
        {
            "value": "2",
            "text": "MC Credit Card",
            "description": "45 1010 1023 0123 2618 9510 1111",
            "suffix": showSuffix ? "(5 000,00 PLN)" : null,
            "groupId": "Cards",
            "iconUrl": "/assets/icons/card_gold.png",
            "ellipsis": true
        }
    ];
}
```

{% hint style="info" %}
Note! If the component domain contains only one account, it is automatically selected and the component becomes disabled.
{% endhint %}

After selection, the component stores the data in the form of an array of objects:

```js
[{
    "value": "1",
    "text": "Zero account",
    "description": "83 1123 1023 0000 2613 9510 0000",
    "suffix": "(14 731,21 PLN)",
    "groupId": "Personal accounts"
}]
```

Demo application:

{% hint style="info" %}
Demo application: demoAccountSelector
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eximee.com/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/biblioteka-komponentow-bazowych/2-pola-wyboru/wybor-rachunku-accountselector.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
