cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
shibathedog
Helper I
Helper I

Patching multiple rows from a selected item in a Gallery

Reposting because last post isn't accessible anymore.

 

Hi, I have some issues with figuring out the patching formula so any help would be appreciated!

 

I have a table (named Projects) in excel which I connected to a gallery.

This is the example table:

CompanyProjectFinished?
AOne 
ATwo 
BThree 
BFive 
BFour 
BSix 
CEight 
CTen 
CNine 

And I have a Gallery (named GalleryCompany) which shows the items A and B.

 

I want to make a button that would patch all of the Projects under company A or B, depending on which one is selected in the GalleryComapany. That means if I select the C (Title1 of GalleryCompany) in the list and click the button, the projects Eight, Nine and Ten should get a "Yes" Tag in the Finished? column.

 

This is the code I've been trying to apply but without success:

 

 

ForAll(Projects.Project,
Patch(Projects, LookUp(Projects, Company = Title1.Text),
{Finshed?: "Yes"}
))

 

 

 

EDIT: I also tried with this but the same happens (just the first value gets updated):

 

 

ForAll(Projects.Project,
Patch(Projects, LookUp(Projects, Company = GalleryCompany.Selected.Result),
{Finshed?: "Yes"}
))

 

 

 

 

Only the first record (Eight) gets tagged. I also tried with the UpdateIf formula but that didn't write anything. I also tried changing the ForAll source to the gallery but didn't get anything.

 

Any suggestions or help would be great! I am still very new and learning the ropes of PowerApps 🙂

 

Thank you in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@shibathedog 

Please consider changing your Formula to the following:

UpdateIf(
    Projects, 
    Company = GalleryCompany.Selected.Title1.Text),
    {Finshed?: "Yes"}
)

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

5 REPLIES 5
RandyHayes
Super User III
Super User III

@shibathedog 

Please consider changing your Formula to the following:

UpdateIf(
    Projects, 
    Company = GalleryCompany.Selected.Title1.Text),
    {Finshed?: "Yes"}
)

I hope this is helpful for you. 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

@RandyHayes Thank you so much! You're a life saver! Works perfectly and I don't even have to use ForAll 🙂

RandyHayes
Super User III
Super User III

@shibathedog 

No problem.

 

And...keep in mind that although you can use a ForAll as a quasi-for/loop, it is really intended to return a Table.

So in your original attempts, your table was going to nowhere. 

If you had used that formula then this would have been the approach:

Collect(Projects,
    ForAll(Filter(Projects, Company=GalleryCompany.Selected.Title1.Text),
        {ID: ID,
         Finshed?: "Yes"
        }
    )
)

 

UpdateIf is the best in this scenario.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
askondo
Community Support
Community Support

@RandyHayes Your answers are very helpful to users of the forum. Excellent!

shibathedog
Helper I
Helper I

Thank you @RandyHayes for the detailed explanation!

And I have to agree with @askondo, I learned so much from your other solutions as well 🙂 Great community!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,355)