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
Super User
Super User

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
Super User
Super User

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
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.

Users online (1,423)