cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
FrancoP
Frequent Visitor

Text string input to SP List row

Hi.

 

I'm new to Power Apps and taking a stab at making an inventory tool using QR code and a USB handheld scanner gun to scan data into a SharePoint List. I am able to build the QR Code with whatever data and characters I need. The QR code generates a single line of text with any delimiter I want. At the moment I'm using TABs as my delimiter as it makes the output easy to read and to past into Excel when needed.  In a Power App, I will capture the data in a text input and using the OnChange property I'd like to get the text input split into multiple columns and entered into a single row of a SharePoint List. 

 

Example data: 

Orange 3 3/2/2022 123

 

I'd like have this entered into a SharePoint List row with the following column names:

Color Count Date ID

 

 Thanks for any help you can offer.

 

1 ACCEPTED SOLUTION

Accepted Solutions
fuzzy_fuzz
Resolver II
Resolver II

You can Split the text by the blank space between the data and store it in a collection: 

ClearCollect(
    colSplit;
    Split(Text; " ")
)

  Then to populate your Sharepoint List use the Collect function and this twi functions together to get the Nth item from the collection: Last(FirstN(col, N)).Value

Collect(
    SPList;
    {
        Color: Last(FirstN(colSplit, 1)).Value;
        Count: Last(FirstN(colSplit, 2)).Value;
        Date: Last(FirstN(colSplit, 3)).Value;
        ID: Last(FirstN(colSplit, 4)).Value
    }
)

I'm sure there could be a better way to do this but if I understood well I think this will work for you.

View solution in original post

2 REPLIES 2
fuzzy_fuzz
Resolver II
Resolver II

You can Split the text by the blank space between the data and store it in a collection: 

ClearCollect(
    colSplit;
    Split(Text; " ")
)

  Then to populate your Sharepoint List use the Collect function and this twi functions together to get the Nth item from the collection: Last(FirstN(col, N)).Value

Collect(
    SPList;
    {
        Color: Last(FirstN(colSplit, 1)).Value;
        Count: Last(FirstN(colSplit, 2)).Value;
        Date: Last(FirstN(colSplit, 3)).Value;
        ID: Last(FirstN(colSplit, 4)).Value
    }
)

I'm sure there could be a better way to do this but if I understood well I think this will work for you.

Hi fuzzy_fuzzy.

 

Thanks very much. This works great with just some tweaks to get the punctuation correct otherwise the App Checker shows errors. Here is what worked for me in the OnChange property for a text input:

 

ClearCollect(colSplit,Split(TextInput1.Text," "));Collect(TestList,{Color:Last(FirstN(colSplit,1)).Result,Count:Last(FirstN(colSplit,2)).Result,Date:Last(FirstN(colSplit,3)).Result,Title:Last(FirstN(colSplit,4)).Result});Reset(Self);SetFocus(Self) 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (1,797)