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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,330)