cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Super User
Super User

Patch multiple rows to Dataverse from text input field

Hi there, 

 

I am creating a deskbooking app and there is a functionality whereby certain users can register guests. 

 

In the text input field "VisitorNames", I want the user to be able to type their names, separated by commas, which then PowerApps recognises as two or more people. 

 

On submission, I want then a patch command to take each individual person recognised in this text input field and create a new row on Dataverse for each of these visitors (so for each person, as separated by commas).

 

Further more, there is a text input field for the visitor's email address. As long as the user enters their email addresses in the right order, I would like then the Dataverse patch row to include the visitor's name and their email address on the same row.

 

Any ideas?

 

Thanks

K.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Kosenurm :

Please try:

With(
    {
        String1: "John Smith, Andrew Smith, Wendy Smith",
        String2: "ohnsmith@fake.com, andrewsmith@fake.com, wendysmith@fake.com"
    },
    ForAll(
        Sequence(CountRows(Split(String1,",")),1,1),
        Patch(
        YourDataSource,
        Defaults(YourDataSource)
        {
            'Visitor Name': Last(FirstN(Split(String1,","),Value)).Result,
            'Visitor Email': Last(FirstN(Split(String2,","),Value)).Result
        }
       )
    )
)

Best Regards,

Bof

View solution in original post

6 REPLIES 6
Nogueira1306
Super User
Super User

Okay... SO I assume you want to submit several itens.. 

Try these:

ForAll(

Patch(

DataSource,

Defaults(DataSource),

{...})

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

 

Thank you for the quick reply. This looks good. I know it's cheeky, but let's say that the visitors names input text field was "John Smith, Andrew Smith, Wendy Smith" with email addresses in another textfield of "johnsmith@fake.com, andrewsmith@fake.com, wendysmith@fake.com"  - how would this be entered into the ForAll and Patch statements?

 

The dataverse column their names would go into is called "Visitor Name" in a "Visitors" Dataverse table, with the column for email being "Visitor Email".

 

Many thanks for your help

 

K.

Hmmmm, we could try a concatenate or 

 

ForAll(

Patch(

DataSource,

Defaults(DataSource),

{...,

Visitors: {....}

})

 

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Thanks, could you give me an example completed formula if at all possible?

 

Many thanks again

K.

ForAll(

Patch(

DataSource,

Defaults(DataSource),

{Name: TextInput1.Text,

Numebr: TextInput2.Text,

Visitors: {Combobox.SelectedItems.Email}

})

 

If you need additional help please tag me in your reply and please like my reply.
If my reply provided you with a solution, pleased mark it as a solution ✔️!

Best regards,
Gonçalo Nogueira

Check my LinkedIn!

Check my User Group (pt-PT)!

Hi @Kosenurm :

Please try:

With(
    {
        String1: "John Smith, Andrew Smith, Wendy Smith",
        String2: "ohnsmith@fake.com, andrewsmith@fake.com, wendysmith@fake.com"
    },
    ForAll(
        Sequence(CountRows(Split(String1,",")),1,1),
        Patch(
        YourDataSource,
        Defaults(YourDataSource)
        {
            'Visitor Name': Last(FirstN(Split(String1,","),Value)).Result,
            'Visitor Email': Last(FirstN(Split(String2,","),Value)).Result
        }
       )
    )
)

Best Regards,

Bof

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,290)