Power Apps Split String into Repeating Table [With Examples]

A few weeks before, I developed an application for employee travel authorization where SharePoint lists are used to store those data.

For a travel request, there might be multiple flights and family details. So, we took those fields as multiple lines of text and stored those data. Now, we are required to split those data and display them on the Power Apps repeating table.

In this article, I will explain how to split string into Repeating table in Power Apps with a simple example.

Power Apps Split String into Repeating Table

In the image below, you can see the SharePoint list has Familydata and FlightDetails multi-line text fields and contains concatenated large strings. Those large strings are displayed on the Power Apps repeating table.

split the power apps large string into repeating table

Look below at the concatenated string in the SharePoint list’s flight and family details fields!

how to split the powerapps large string into repeating table

Family data:

SNO:1, FullName: LidiaHolloway, Age: 24, Relation: Sister
SNO:2, FullName: Berlin, Age: 25, Relation: Cousin
SNO:3, FullName: Gardy Yark, Age: 56, Relation: Father
SNO:4, FullName: Henrita, Age: 30, Relation: Sister

Which has four fields of data:

  • SNO
  • FullName
  • Age
  • Relation

FlightDetails:

SNO:1, FlightFrom: USA, FlightTo: Italy, FlightDate: 9/16/2024, FlighTicketType: Business
SNO:2, FlightFrom: UK, FlightTo: Brazil, FlightDate: 9/17/2024, FlighTicketType: Economy
SNO:3, FlightFrom: India, FlightTo: Pakisthan, FlightDate: 9/24/2024, FlighTicketType: Business

Which has five fields of data:

  • SNO
  • FlightFrom
  • FlightTo
  • FlightDate
  • FlightTicketType

This SharePoint list has the following fields with the below data types.

Column NameData Type
Employee NameTitle
PositionSingle line of text
DepartmentChoice
Family DataMultiple lines of text
Flight DetailsMultiple lines of text
Start DateDate & Time
End DateDate & Time
DestinationSingle line of text
Follow the steps below to achieve this!

1. Connect the SharePoint list with the Power Apps application. Add one gallery control to display the employee travel request details on the new screen.

Provide the SharePoint list name on its Items property.

'Travel authorization'
power apps split string by delimiter

2. Add the below navigation formula on the arrow icon’s OnSelect property in the gallery to navigate to another screen to display the concatenated string in a repeating table.

Also, we’re creating a collection to store the split data from concatenated strings.

Navigate(Singlerequest_EditScreen,ScreenTransition.CoverRight);
// Split the concatenated string into lines and then into individual fields

ClearCollect(
    collectionFamilyDetails,
    ForAll(
        Filter(Split(Gal_TravelAuthorization.Selected.'Family Data', Char(10)), Len(Trim(Value)) > 0), 
        {
            SNO: Trim(Mid(Value, Find("SNO:", Value) + 4, Find(",", Value) - Find("SNO:", Value) - 4)),
            FullName: Trim(Mid(Value, Find("FullName:", Value) + 9, Find(",", Value, Find("FullName:", Value)) - Find("FullName:", Value) - 9)),
            Age: Trim(Mid(Value, Find("Age:", Value) + 4, Find(",", Value, Find("Age:", Value)) - Find("Age:", Value) - 4)),
            Relation: Trim(Mid(Value, Find("Relation:", Value) + 9, Len(Value) - Find("Relation:", Value) - 8))
        }
    )
);


ClearCollect(
    collectionFlightDetails,
    ForAll(
        Filter(Split(Gal_TravelAuthorization.Selected.'Flight Details', Char(10)), Len(Trim(Value)) > 0), 
        {
            SNO: Trim(Mid(Value, Find("SNO:", Value) + 4, Find(",", Value) - Find("SNO:", Value) - 4)),
            FlightFrom: Trim(Mid(Value, Find("FlightFrom:", Value) + 11, Find(",", Value, Find("FlightFrom:", Value)) - Find("FlightFrom:", Value) - 11)),
            FlightTo: Trim(Mid(Value, Find("FlightTo:", Value) + 9, Find(",", Value, Find("FlightTo:", Value)) - Find("FlightTo:", Value) - 9)),
            FlightDate: Trim(Mid(Value, Find("FlightDate:", Value) + 11, Find(",", Value, Find("FlightDate:", Value)) - Find("FlightDate:", Value) - 11)),
            FlightTicketType: Trim(Mid(Value, Find("FlighTicketType:", Value) + 16, Len(Value) - Find("FlighTicketType:", Value) - 15))
        }
    )
)

Here, the Navigate() function contains the screen name with a screen transition. Singlerequest_EditScreen is the screen name.

  • collectionFamilyDetails = Collection name that contains family details split data.
  • Split () = split the gallery selected family data field data with Char(10) [ new line].
  • Filter () = It filters the split data, which has a length of more than 0.
  • ForAll() = It iterates over each line split by char(10).
  • Find() = It finds the field names like “SNO: “, ” FullName: “, “Age:”, and “Relation: ” on each line, then uses the Mid(), Trim() function fetching values for the above fields.
  • This process will repeat for each line that splits from Char(10) using a forall function.
  • SNO, FullName, Age, and Relation are the filed names created in this collection.
  • collectionFlightDetails = Collection name that contains flight details split data.
  • SNO, FlightFrom, FlightTo, FlightDate, and FlightTicketType are the fields created in the above collection.

From the string “SNO:1”, we’re excluding the field names that are “SNO:” and fetching only their values and storing them in the new fields created in the collection.

powerapps split string new line

The collection will look like in the image below.

power apps split string data into collection

3. Add a scrollable screen with a Canvas object within that DataCard present, and add a Container to this data card. Add one Edit Form control and two gallery controls within the Container.

Provide the formulas below for the given properties for the Edit Form control. Avoid including flight and family details fields in this form.

DataSource ='Travel authorization'
item = Gal_TravelAuthorization.Selected
Display mode =view
Columns =1
Layout = Horizontal
split strings to repeating table in powerapps

4. Add four text input controls within the gallery and provide the collection name below on the gallery’s Items property to display family details.

collectionFamilyDetails
how to split strings to repeating table in powerapps

5. Provide the formulas below for each text input control for its Default property.

SNO = ThisItem.SNO
FullName = ThisItem.FullName
Relation = ThisItem.Relation
Age =ThisItem.Relation
Add new line Items to repeating tables in Power Apps

6. Add the following controls to another gallery to display flight details. Also, provide the collection name below on the gallery’s Items property.

collectionFlightDetails
  • Three text input controls = SNO, FlightFrom, FlightTo
  • Flight Date = Date picker
  • Flight Ticket Type = Dropdown
add new line items to repeating tables in power apps canvas app

7. For each control present in this gallery, provide the below formulas on its Default property:

  • SNO= ThisItem.SNO
  • FlightFrom= ThisItem.FlightFrom
  • FlightTo = ThisItem.FlightTo
  • Flight Date = ThisItem.FlightDate
  • Flight Ticket Type = ThisItem.FlightTicketType
add split string items by new line into power apps repeating table

8. On this screen, add one Home icon to navigate back to the previous screen. Add the below code to its OnSelect property.

Navigate(TravelAuthorization_screen,ScreenTransition.CoverRight)
powerapps split expected text value and new line

Save and publish the application. Now, click on items present in the gallery, and it navigates to another screen displaying the concatenated large string on the repeating table and the remaining fields on the form control.

power apps split string into table

I hope you understand splitting the string into the Power Apps repeating table. Here, I have explained how to create a collection to store the split string data and display those collection data clearly on the Power Apps repeating table. Follow this article while trying to split the large strings with new lines and some predefined words and fetch particular data.

Also, you may like:

>
Download User registration canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial

FREE Power Platform Tutorial PDF

Download 120 Page FREE PDF on Microsoft Power Platform Tutorial. Learn Now…