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.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (2,196)