# Passing values between components or form pages

Platform **Eximee Designer** allows values to be passed from one component to another. Depending on whether the components are in the same artifact or in two different ones, value passing is done in different ways. We will also act differently in a situation where we want only to pass a value, and differently when we want to use the passed value, e.g. by making visibility depend on it.

## Passing a value between components located in the same artifact <a href="#przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazaniewartoscimiedzykomponentamiznajd" id="przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazaniewartoscimiedzykomponentamiznajd"></a>

If there is a need to copy a value from one Text Field (TextField) to another or to another component, e.g. to the content of a statement, or from a Value Selection Field from a list (Combobox) displaying a list of identity document types to another Combobox, in the component to which we want to pass the value you can:

* Use the script *EchoServiceScript* (choose in the **Interactions** section in the **EXTERNAL DATA SOURCE** field the **Choose service** option and point to that script), in which you need to provide the data-providing component as input. In the script output parameters, the script output should be mapped appropriately to the component attribute. This approach additionally gives us the ability to specify a formatter that will appropriately modify the data received from the script.

  <figure><img src="/files/a44ad36d7873bf398d5deb33304d4e15aa865ba3" alt=""><figcaption><p align="center"><em><strong>Figure 1.</strong> Example of the attached "EchoServiceScript" script</em></p></figcaption></figure>
* Select in the **DATA SOURCE FROM ANOTHER FIELD** field the data-providing component:

<figure><img src="/files/3d952e0e11fa0d7dccfabc18eecd57b0b97fa96f" alt=""><figcaption><p align="center"><em><strong>Figure 2.</strong> Setting the data source as the component from which the data will be retrieved</em></p></figcaption></figure>

* Select in the **DATA SOURCE FROM ANOTHER FIELD** a session variable for which a service has been defined that passes a value from another component:\ <br>

  <figure><img src="/files/5127e614100ce8bc4114478ea545973c56bd5151" alt=""><figcaption><p align="center"><em><strong>Figure 3.</strong> Setting the session variable from which values will be passed</em></p></figcaption></figure>
* Select in the **EXTERNAL DATA SOURCE** a service previously defined on the page (with input from the component passing the data):<br>

  <figure><img src="/files/ab285d5b76cc26f7054fcb480933dffb3b39cafd" alt=""><figcaption><p align="center"><em><strong>Figure 4.</strong> Attaching "PageService"</em></p></figcaption></figure>

{% hint style="info" %}
In all cases, remember to listen on the component whose value you are copying (more in the topic: [Listening and clearing](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/dynamicznosc-formularza/nasluchiwanie-i-czyszczenie.md)).<br>
{% endhint %}

<figure><img src="/files/922d9de8de22ab4f1e2acf56414c244d7d5fbbec" alt=""><figcaption><p align="center"><em><strong>Figure 5.</strong> Example of copying values from Text Fields to Labels</em><br><em>(using "EchoService", "DATA SOURCE FROM ANOTHER FIELD" and a session variable)</em></p></figcaption></figure>

Applying the above instructions to a Value Selection Field from a list/Date (and other components that pass a value, not the presented content, label or description) would result in passing the value of that component. To pass the text (description or label), you should:

* if we want to pass the content (label or description) through **DATA SOURCE FROM ANOTHER FIELD**, instead of selecting the data-providing component there, enter:<br>
  * for the Value Selection Field from a list (Combobox), append **$label**, e.g. *GesCombobox1$label*:

    <figure><img src="/files/ac6f00184e71037e1d058a442503338a3cbb805d" alt=""><figcaption><p align="center"><em><strong>Figure 6.</strong> Passing text from the Value Selection Field from a list (Combobox) component</em></p></figcaption></figure>

    <p align="center"><br></p>
  * for Date (DatePicker), append **$displayValue**, e.g. *GesDatePicker1$displayValue*
* if we want to use the content (label or description) in the content of another component (e.g. in a section title, add it to the content or label), refer to this Value Selection Field from a list/Date as follows:<br>
  * for the Value Selection Field from a list, provide the component ID in curly braces preceded by a dollar sign with *$label,* e.g. *${GesCombobox1$label}*:<br>

    <figure><img src="/files/e929c5985b6932a7a1f6c959b546ed41447a6c2e" alt=""><figcaption><p align="center"><em><strong>Figure 7.</strong> Example of using text from the Value Selection Field from a list in a section title</em></p></figcaption></figure>

<p align="center"><br></p>

* for Date, provide the component ID in curly braces preceded by a dollar sign with *$displayValue,* e.g. *${GesDatePicker1$displayValue}.*

{% hint style="info" %}
The list of component attributes available after "$" is described in: [Component attributes](/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/jezyk-wyrazen-definiowania-warunkow-warunki-z-getvalue/atrybuty-komponentow.md).
{% endhint %}

## Passing a value between components located in different artifacts <a href="#przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazaniewartoscimiedzykomponentamiznajd" id="przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazaniewartoscimiedzykomponentamiznajd"></a>

If the components are not in one artifact (the same composite component), values must be injected into the fed artifact. It does not matter whether both composite components are located on the same application page.

Passing values is a two-step process. First, in the component that will receive values, define the input parameters, and then in the parent artifact map the appropriate data-providing components. The first step may vary, and its complexity depends on whether we only want to pass a value from one component to another or whether we additionally want another action to depend on that value, e.g. component visibility.

The general definition describing passing values to composite components is available here: [Composite component input parameters](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/komponenty-rozszerzone/komponenty-zlozone.md#parametry-wejsciowe). However, special cases of value passing are not described there.

### Passing values directly <a href="#przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazywaniewartosciwprost" id="przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazywaniewartosciwprost"></a>

If we want to use the passed data directly, i.e. only pass a value from one component to another (e.g. create a summary of the data entered in the application), then in the composite component receiving the values you should define input parameters, i.e. indicate the components to which we will pass the value. To do this, select the option in the left panel **Input parameters**, and then **Add input parameter**. In the **Application component** column, select the form field or session variable to which you want to pass the value:<br>

<figure><img src="/files/f81e221360aa4681d63822d0af3dee68f3e63d1f" alt=""><figcaption><p align="center"><em><strong>Figure 8.</strong> Example of defined input parameters for components and session variables</em></p></figcaption></figure>

After defining the input fields, save the composite component and open the artifact in which this component was embedded.

The next step is to map the values to the appropriate input fields, which must be done in the parent artifact relative to both composite components (the one passing and the one receiving values). After selecting the artifact receiving values, click the **INPUT PARAMETERS** option in the properties of this component and set the sources of the retrieved values in the slide-out drawer.

{% hint style="info" %}
If after clicking the property **INPUT PARAMETERS** the list of parameters is not visible, refresh the console window.
{% endhint %}

<figure><img src="/files/8341e69eaa1986e1c2c56b353c3e6029c648104b" alt=""><figcaption><p align="center"><em><strong>Figure 9.</strong> Example of mapping parameters to components of the artifact passing values (e.g. GesComplexComponent1.GesTextField3) and session variables (e.g. imieNazwiskoPesel)</em></p></figcaption></figure>

### Passing a value to a session variable and further use of the passed value <a href="#przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazaniewartoscidozmiennejsesyjnejidals" id="przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-przekazaniewartoscidozmiennejsesyjnejidals"></a>

If we want another action to depend on the value passed to a component, e.g. component visibility, requiredness, or displaying the value of a Value Selection Field from a list in a label, the injected value should be passed to a session variable (instead of directly to the component).

The first stage, consisting of indicating the elements to which values will be passed, should begin by creating session variables. To do this, select the option in the left panel **Session variables** and click the **Add session variable***.* button. In the slide-out panel, in the empty row created at the top, set the session variable name (detailed instructions here: [Managing session variables](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/zmienne-sesyjne/zarzadzanie-zmiennymi-sesyjnymi.md)). After creating the session variables, define value passing for them, which is done in the same way as for components (in the **Input parameters** panel, indicate each session variable to which you want to pass a value).

The second stage, i.e. mapping the values to the appropriate input fields in the parent artifact, is carried out identically as for components (after selecting the artifact receiving values, click the **INPUT PARAMETERS** option in the properties of this component and set the sources of the retrieved values in the slide-out drawer).

Examples of using the value passed to a session variable are described in [Managing session variables](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/formularze/zmienne-sesyjne/zarzadzanie-zmiennymi-sesyjnymi.md) and below.

### Various examples of passing values <a href="#przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-rozneprzykladyprzekazywaniawartosci" id="przekazywaniewartoscimiedzykomponentamilubstronamiwniosku-rozneprzykladyprzekazywaniawartosci"></a>

#### **Filling a label (Text component) directly from another field**

* in the artifact to which we want to pass the value for the label, define this label as an input field (in the **Input parameters**)*,*
* in the parent artifact, map the appropriate component that is to pass data to the label (the property of the **INPUT PARAMETERS** composite component).

**Filling a label with several session variables**

* in the artifact to which we want to pass the value, create session variables and set them as input fields (in the **Input parameters**),
* in the label we want to populate, in the **Content** property enter the variable names using the dollar sign{name\_of\_variable} scheme (i.e. *${imie});* you can add any content before or after the reference to the session variable, e.g. *Ms. ${imie}*,
* in the label we want to populate, add listening to the used variables (section **Interactions**, button **List** in the **Listening**),
* in the parent artifact map the appropriate components that are to pass the value to the created session variables (the property **INPUT PARAMETERS**).<br>

  <figure><img src="/files/0d6dc8a9a2bbba578a00afd7078b40f73ca1f34e" alt=""><figcaption><p align="center"><em><strong>Figure 10.</strong> Example of using session variables (first name and last name) in the "Label" component to pass a value</em></p></figcaption></figure>

#### **Filling a label with the value of a "Value Selection Field from a list" (Combobox)**

Filling a label directly with the value from a Value Selection Field from a list would result in displaying the key of the selected value, therefore it is necessary to use the instructions below:

* in the artifact to which we want to pass the value for the label, define this label as an input field (in the **Input parameters**)
* in the parent artifact, map the appropriate Combobox that is to pass data to the label (the property **INPUT PARAMETERS** of the composite component)
* in the XML source of the parent artifact, add **$label** after the id **of the Combobox** passing the value, i.e. if mapping has been set to *Combobox1,* then in the record \<data:InputMapping componentId="**GesComplexComponent1.GesCombobox1**" alias="typDokumentuTozsamosci"/>) after the id you should enter *$label* (here "**GesComplexComponent1.GesCombobox1$label**")

#### **Filling a label with the value from a Date component (DatePicker), Radio Group and others**

Filling a label directly from a Date will display the value of the selected date as a timestamp, therefore it is necessary to use the instructions below:

* in the artifact to which we want to pass the value for the label, define this label as an input field (in the **Input parameters**),
* in the parent artifact, map the appropriate date component that is to pass data to the label (the property **INPUT PARAMETERS** of the composite component),
* in the XML source of the parent artifact, in the row responsible for mapping to the Date component, add after the component id ***$displayValue**.*<br>

The above instructions also apply to Radio Group, Product Selection and other components that pass a value, not the presented content, label or description. In the way described, the value can be passed to a label, but also to a Text Field or Formatted Content (TextContent) component.

**Filling a session variable in another component with the value of a "Value Selection Field from a list" (Combobox)**

If there is a need to fill a session variable or several components with the value of a Value Selection Field from a list located in another artifact, then the value itself, not its key, should be passed to that variable. To do this, it is worth creating a technical field, to which in the field **DATA SOURCE FROM ANOTHER FIELD** we add **$label**. In this way, the technical field already has the value of the Combobox and we can map this value to any artifact.

See also: [Composite component input parameters](/documentation/documentation-en/budowanie-aplikacji/interfejs-uzytkownika/komponenty-rozszerzone/komponenty-zlozone.md#parametry-wejsciowe).

{% hint style="info" %}
In one composite component, values can be passed directly to a component as well as to session variables. The method of passing depends on the further use of the injected values.
{% endhint %}


---

# 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.eximee.com/documentation/documentation-en/budowanie-aplikacji/logika-biznesowa/przekazywanie-wartosci-miedzy-komponentami-lub-stronami-wniosku.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.
