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

Problems with patching multiple gallery items' listbox data to a collection, then passing the collection to a data source

I have a gallery of names, a dropdown, a listbox and a submit button.  The user filters the names via the dropdown, selects a name from the gallery, makes some selections from the listbox, then submits it and it gets patched to my data source. That works but is not ideal because of the delay after each patch.

 

I want to rather patch the listbox selections to a collection, then at the end of a session of multiple gallery item edits via the listbox I want to patch the whole collection to my data source once, but I’m having problems getting this right.

 

The gallery’s OnSelect:

Set(varRecord,ThisItem);

The submit button’s OnSelect:

Patch(
    TraineeData,
    {
        PositiveBehaviours:Label4.Text
    }
)

Label4’s’s Text:

Concat(ListBox1.SelectedItems,PositiveBehaviours,", ")

I created a collection of all filtered items when the user chooses an option from the dropdown.  Dropdown1_14’s OnSelect:

ClearCollect(GroupTrainees,Gallery2_6.AllItems);

I’ve created a temporary button to patch the selections to the collection with its OnSelect:

Patch(
    GroupTrainees,
    {
        PositiveBehaviours:Label4.Text
    }   
)

I think that works, but I’m having difficulty patching my collection to the data source afterwards.  I’ve duplicated the temporary button and tried adjusting its code to have the collection go to the data source, but that throws an error, expecting a record while trying to pass it text, for example.

 

Any help or a point in the right direction would really be appreciated! Where am I going wrong with this?

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
PG_WorXz10
Community Champion
Community Champion

Hi @JJKuZu , 

 

Try ForAll if you are using multiple value patch. Try the default formula mentioned below and update it according to your controls names. 

ForAll(gallery.AllItems As Item, Patch(GroupTrainees, Defaults(GroupTrainees),{PositiveBehaviours: Item.Label4.Text}) )

 

 

 

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

View solution in original post

2 REPLIES 2
PG_WorXz10
Community Champion
Community Champion

Hi @JJKuZu , 

 

Try ForAll if you are using multiple value patch. Try the default formula mentioned below and update it according to your controls names. 

ForAll(gallery.AllItems As Item, Patch(GroupTrainees, Defaults(GroupTrainees),{PositiveBehaviours: Item.Label4.Text}) )

 

 

 

 

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

Thank you!!

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (3,993)