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

Patch all items in Gallery

 

PowerApps2.JPGI don't know if this is possible. I've seen other posts online of people exploring saving things in a Gallery but i'm not sure if my specific setting will work. Basically I have a Gallery that shows the "astID" field of a Collection and a textbox that shows the "astExplanation" field from the same collection. I want the user to be able to fill in the textboxes then click Save and have all the records in the gallery patched or updated with the new data. This is what I currently have on the Save button. I don't have any errors but it doesn't work. Nothing happens when clicked. 

 

ForAll(Gallery3.AllItems, Patch(tblInvenTemp, {astID: Label34.Text},{astExplanation:TextInput3.Text}))

And I know I should rename the label and textbox.  

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Power Participant
Power Participant

Re: Patch all items in Gallery

You have to get the record to Patch, probably through a Lookup. The real question is if there's a way to get the underlying record without using a Lookup, since it is there anyway in the gallery, just moxed up with everything else.

 

I have a similar problem with my app last week, and I solved it by creating an alias for the ID-column. You can read my fix here: https://powerusers.microsoft.com/t5/General-Discussion/Patch-problem-worked-before-now-it-doesn-t/m-...

 

God luck!

View solution in original post

9 REPLIES 9
Highlighted
Anonymous
Not applicable

Re: Patch all items in Gallery

Hi @Blinkorta

 

I am not sure why it does not work. Does it give you any error in the Button.OnSelect?

 

It might be that your Patch second argument is incorrectly selecting a record, what if you tried this function:

 

ForAll(
    Gallery3.AllItems,
    Patch(
        tblInvenTemp,
        LookUp(tblInvenTemp,astID = Label34.Text),
        {
            astExplanation:TextInput3.Text
        }
    )
)

 

Highlighted
Frequent Visitor

Re: Patch all items in Gallery

I don't have any errors on the button. I tried your code, same result. No errors but it also doesn't do anything. 

Highlighted
Frequent Visitor

Re: Patch all items in Gallery

Did you manage to get this working in the end? I am trying to do a similar thing where I have managed toget it to work through a flow but I'd much rather the patch work.

Highlighted
Memorable Member
Memorable Member

Re: Patch all items in Gallery


@Blinkorta wrote:

 

PowerApps2.JPGI don't know if this is possible. I've seen other posts online of people exploring saving things in a Gallery but i'm not sure if my specific setting will work. Basically I have a Gallery that shows the "astID" field of a Collection and a textbox that shows the "astExplanation" field from the same collection. I want the user to be able to fill in the textboxes then click Save and have all the records in the gallery patched or updated with the new data. This is what I currently have on the Save button. I don't have any errors but it doesn't work. Nothing happens when clicked. 

 

ForAll(Gallery3.AllItems, Patch(tblInvenTemp, {astID: Label34.Text},{astExplanation:TextInput3.Text}))

And I know I should rename the label and textbox.  


 

How are you putting the astID into Label34? If you are using "ThisItem." then I would test your ForAll Patch with:

ForAll(Gallery3.AllItems, Patch(tblInvenTemp, {astID: ThisItem.astID},{astExplanation:TextInput3.Text}))

or just:

 

ForAll(Gallery3.AllItems, Patch(tblInvenTemp, {astID: astID},{astExplanation:TextInput3.Text}))

 

I actually use exactly what you are doing in a few spots and it works great in our case by just saying "Field:Field" for the record and it just works.

Highlighted
Power Participant
Power Participant

Re: Patch all items in Gallery

You have to get the record to Patch, probably through a Lookup. The real question is if there's a way to get the underlying record without using a Lookup, since it is there anyway in the gallery, just moxed up with everything else.

 

I have a similar problem with my app last week, and I solved it by creating an alias for the ID-column. You can read my fix here: https://powerusers.microsoft.com/t5/General-Discussion/Patch-problem-worked-before-now-it-doesn-t/m-...

 

God luck!

View solution in original post

Regular Visitor

Re: Patch all items in Gallery

If you are trying to save to the Collection, Change "Patch" to "Collect" 

 

Highlighted
Frequent Visitor

Re: Patch all items in Gallery

Hi, Collect is not working for me.could you please suggest. I have created a Powerapps forms that shows all questions  with Textboxes (inserted beside question) as gallery, and I am trying to save user entered responses in Tetboxes to other SPList.Could you please suggest.

Highlighted
Post Prodigy
Post Prodigy

Re: Patch all items in Gallery

Hi @Blinkorta 
Hi @srevoju 

Have you found your solution?
Can you please share what is the solution?
And, what formula function you actually use to solved the issue?

Thanks.

BR,

pytbyt

Highlighted
Advocate V
Advocate V

Re: Patch all items in Gallery

I just got this to work. I am using COLLECT, not PATCH.

 

To the left is my gallery. To the right is a data table that shows the contents of of the collection: colOrderList.

 

20191104 10_49_46-Biker Orders using ForAll - Saved (Unpublished) - PowerApps.png

The Collect button has the following code:

 

ForAll(
    galOrderQuantity.AllItems,
    Collect(
        colOrderList,
        {
            Item: lblItemNumber.Text,
            Quantity: Value(txtOrderQuantity.Text)
        }
    )
)

 

lblItemNumber is the field in the gallery with the item number, and txtOrderQuantity is the field in the gallery that they fill in with the quantities.

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (6,599)