# Combine a list into a single text

**URL:** <https://community.triggre.com/t/combine-a-list-into-a-single-text/802>\
**Category:** Data\
**Tags:** data, designer, pick-list\
**Created:** [August 20, 2024, 7:00am UTC](https://community.triggre.com/t/combine-a-list-into-a-single-text/802 "2024-08-20T07:00:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mar](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.triggre.com/mar/32/395_2.png) [@Mar](https://community.triggre.com/u/Mar)\
**Post date:** [August 20, 2024, 7:00am UTC](https://community.triggre.com/t/combine-a-list-into-a-single-text/802/1 "2024-08-20T07:00:00Z")

</div>

In Triggre, you can use either a single **Data item** or a **List** of **Data items** to perform operations with. When using a **List** , in some cases you want to use a single value from each of the **Data items** in the **List** and combine them into a single text value.

In this article we will show you how this can easily be done using a **Repeat action** in a **Flow Part**. As an example we will use a **List** of **Relations** to build a single text of all first names of those **Relations.**

 ![Relation list overview](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/26d3cbb582c12e2f9ae036f20ec02d6ba9d03442.png)

# Setup

1. Create a **Data Item** for storing the temporary value, e.g. _Temp combine all first names._

2. Create a **Property** within the **Data Item** for the storage of the actual value, e.g. _Combined first names._  
Given the examples, the result should look like this:  

3. Create a new **Flow part** and then rename it to _Combine Relation first names in text_:  

# Designing the Flow Part

1. Use the add data action to create a _Temp combine all first names_ **Data Item**. Leave the value of the _Combined first names_ **Property** empty.

2. Add a **Lookup** action to the **Flow Part** to create the **List** of **Relations**.  
In this example we will leave the selection empty to select all **Relations**.  

3. Add a **Repeat action** after the **Lookup** for the **List** of **Relations**.

4. Open the **Repeat action** and add a **Caculation** action to add the value of the current **Relation** to the value of the _Temp combine all first names_.  

5. After the **Calculation** action, add an **Update action** to save the newly calculated value into the _Combined first names_ attribute in the _Temp combine all first names_ **Data item** to replace the old value.  

6. After completing the action, finalize the **Repeat action** by connecting the **Update action** to the end of the flow, by choosing **End the repeat action**.  
The flow in your **Repeat action** should now look like this:  

7. Close the **Repeat flow** by clicking the **Arrow** in the left top side corner of the screen..  
We now have added the first name from each **Relation** to the text value in the _Temp combine all first names_ **Data item**. However, we have also added a separating character (the comma) for each item to the text, including the first **Data item** that was processed. For this first **Data item** , no separator value is necessary, so we should remove that from the string value in the _Temp combine all first names_ **Data item**.

8. After the **Repeat action** , add a new action of the **Calculation** type and use the **Function**  **CUT A FROM B TO END** to keep everything but the first separator in the text value.  
Since we have used only one character (a comma) as a separator, we start cutting the text value from position 2.  

9. Add an **Edit data** action to your **Flow Part** to update the _Temp combine all first names_ **Data item**.

After the previous steps, your **Flow Part** should look like this:

 ![Final Flow part overview](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/1741baaeec1592f2f3f2a57850e64a0beb24e935.png)

You are now ready to use it in your application.  
When using this **Flow Part** , always make sure to clear the entire _Temp combine all first names_ **Data item** before the **Flow Part** is executed. That way you make sure to start with a clean **List** every time.

## Tip 1

In this example we have used a comma to separate each first name. This can be replaced by any other separating value, such as only a comma and a space, a semi-colon (“;”), a slash (“/” or “\”), etcetera, depending on the goal you have with the single text value.

## Tip 2

In this example we have combined the selection of the **List** and the **Repeat action** in a single **Flow Part**. Since the selection criteria may vary in your application, you may want to add the **List** as an **Input** parameter to your **Flow Part** and do the actual selection elsewhere, such as in a **User Flow**. In that case the **Lookup** action for **Relations** can be removed from the **Flow Part** and in the **Repeat action** the reference to the **Lookup** result is replaced by a reference to the import parameter **Relations**  **List**.

 ![Combine Relation first names in text final overview](https://canada1.discourse-cdn.com/flex035/uploads/triggre/original/1X/9dbbbb3e466700635eaac0b74613faf8d8a51776.png)
