cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
gumgih
Helper II
Helper II

Submit button to update all gallery items based on radio button selection

Hi,

I am new to powerApps development, want to create a submit button that will update all the gallery items based on radio button selection.

Using below formula to update the SharePoint list, but it is updating all the records based on first selection only. not sure how to do it, can anyone please help.

UpdateIf('Review database accounts', ' Manager Name'= Dropdown1_2.SelectedText.Value && 'Request Status' = Dropdown1.SelectedText.Value, {Action: Radio1.Selected.Value, 'Request Status': "Approved"})

1 ACCEPTED SOLUTION

Accepted Solutions

@gumgih 

Your formula does not appear to be what I had suggested. (with the exception that I notice that your Radio button has "Retain" or "Revoke" now and that would be the filter value rather than "Approved" as I originally suggested). Also, I notice that you are on SharePoint so criteria based on the ID is much more preferable.

ForAll(
    AddColumns(
        Filter(Gallery1.AllItems, 
            Radio1.Selected.Value = "Retain"),
        "id", ID
    ),
    UpdateIf('Review database accounts', 
         ID=id, 
         {Action: Radio1.Selected.Value, 
          'Request Status': "Approved"
         }
     )
)

 

The formula you have replied back with is still trying to filter outside of the gallery...that will not work.  Please use the formula above and test.

 

Also, you are filtering on the Manager Name and Status - is there a particular logic to that?  It's fine if there is and we can incorporate that in, but my impression is that you have a list of items, a user click on "Retain" for those that need to be changed and then when you submit, you want all of those to be Updated.  The assumption is that you are already filtering the list by the Manager Name and the Status...in which case there is no need to filter again - AllItem on the Gallery will be a list of all the filtered items.

 

_____________________________________________________________________________________
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

4 REPLIES 4
RandyHayes
Super User
Super User

@gumgih 

Consider the following change to your formula:

ForAll(Filter(yourGallery.AllItems, Radio1.Selected.Value = "Approved"),
    UpdateIf('Review database accounts', 
         ' Manager Name'= Dropdown1_2.SelectedText.Value && 'Request Status' = Dropdown1.SelectedText.Value, 
         {Action: Radio1.Selected.Value, 
          'Request Status': "Approved"
         }
     )
)

 

If you do not use the AllItems as the basis for your formula, you will only get the first row of your Gallery repeated in all records.

 

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!

Hi @RandyHayes ,

Thanks for your response.

I have updated the formula but still, the result is same. 😞

 

Regards,

Mayank

 

@gumgih 

Your formula does not appear to be what I had suggested. (with the exception that I notice that your Radio button has "Retain" or "Revoke" now and that would be the filter value rather than "Approved" as I originally suggested). Also, I notice that you are on SharePoint so criteria based on the ID is much more preferable.

ForAll(
    AddColumns(
        Filter(Gallery1.AllItems, 
            Radio1.Selected.Value = "Retain"),
        "id", ID
    ),
    UpdateIf('Review database accounts', 
         ID=id, 
         {Action: Radio1.Selected.Value, 
          'Request Status': "Approved"
         }
     )
)

 

The formula you have replied back with is still trying to filter outside of the gallery...that will not work.  Please use the formula above and test.

 

Also, you are filtering on the Manager Name and Status - is there a particular logic to that?  It's fine if there is and we can incorporate that in, but my impression is that you have a list of items, a user click on "Retain" for those that need to be changed and then when you submit, you want all of those to be Updated.  The assumption is that you are already filtering the list by the Manager Name and the Status...in which case there is no need to filter again - AllItem on the Gallery will be a list of all the filtered items.

 

_____________________________________________________________________________________
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 for your assistance.

The below solution works as expected. 🙂

Regards,

Mayank

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,366)