cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HubertWiech
Regular Visitor

Split text and create a collection

I need a user to add several rows in a SharePoint list though a Power app.

In the first textbox they enter the Project number (example:19212-1) (1 value)

In the second textbox the copy a text with a separator (example: YV-111;YV-112;YV-113).

 

I want to split the text and create a collection with the values:

 

Projektnumer:                                Elementnamn:

19212-1                                          YV-111

19212-1                                          YV-112

19212-1                                          YV-113

 

And then save the Collection to the SharePoint list.

 

Thanks for your help.

1 ACCEPTED SOLUTION

Accepted Solutions
eka24
Super User
Super User

You can follow these steps:

To create the Collection, Insert a button and OnSelect:

ClearCollect(colSplited,{Projektnumer: TextInput1.Text, Elementnamn: Split(TextInput2.Text,";")});
ClearCollect(colSplited2,Ungroup(colSplited,"Elementnamn"))

To Patch to the Datasource, Insert Another button with OnSelect:
ForAll(colSplited2,
Patch(Datasource, Defaults(Datasource),
{Column1: Elementnamn, Column2: Projektnumer} ) )
 
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

View solution in original post

2 REPLIES 2
StalinPonnusamy
Super User
Super User

Hi @HubertWiech 

 

We need to split the element field and use the Patch command to create multiple

 

 

ForAll(
    Split(
        ElementInput.Text,
        ","
    ),
    Patch(
        'EK-YV',
        Defaults('EK-YV'),
        {
            Projektnummer:ProjectNumberInput.Text,
            Elementnamn: Result
        }
    )
)

 

 

 

eka24
Super User
Super User

You can follow these steps:

To create the Collection, Insert a button and OnSelect:

ClearCollect(colSplited,{Projektnumer: TextInput1.Text, Elementnamn: Split(TextInput2.Text,";")});
ClearCollect(colSplited2,Ungroup(colSplited,"Elementnamn"))

To Patch to the Datasource, Insert Another button with OnSelect:
ForAll(colSplited2,
Patch(Datasource, Defaults(Datasource),
{Column1: Elementnamn, Column2: Projektnumer} ) )
 
------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (1,869)