cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
SkiDK
Level 8

Get access to elements in a gallery

In a SQL database I have stored several items to display in a gallery, which works. These items are shown as checkboxes, that when these are displayed and one is checked, the Id from that checkbox gets linked with another record in the database.

 

My next step is to patch all the checked (add) and unchecked (delete) boxes to the database. But since this is a gallery, I can't access the Id from these checkboxes. Is there a way to get the specific checkbox from a specific item so that I can store it in the correct place in the database?

 

Thank you very much

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: Get access to elements in a gallery

Hi @SkiDK 

 

You can use a ForAll loop to iterate over all the gallery items, and accessing the value for each item individually:
ForAll(Gallery1.AllItems, If(Checkbox1.Value = false, Remove(DataSource, <<Condition>>), Patch(DataSource,Defaults(DataSource),{Status: Checkbox1.Value})))
Here we are iterating over each gallery item and checking if the checkbox is checked or not, if it is not checked, the item will be removed, else it will patch the record. Please update the actual control names in the formula along with the specific condition to perform operations.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Dual Super User
Dual Super User

Re: Get access to elements in a gallery

Hi @SkiDK 

 

You can use a ForAll loop to iterate over all the gallery items, and accessing the value for each item individually:
ForAll(Gallery1.AllItems, If(Checkbox1.Value = false, Remove(DataSource, <<Condition>>), Patch(DataSource,Defaults(DataSource),{Status: Checkbox1.Value})))
Here we are iterating over each gallery item and checking if the checkbox is checked or not, if it is not checked, the item will be removed, else it will patch the record. Please update the actual control names in the formula along with the specific condition to perform operations.

 

Hope this Helps!

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

SkiDK
Level 8

Re: Get access to elements in a gallery

@yashag2255 

Thanks, you helped very much. Was a bit searching with linking to the correct items in the database, but basically it worked.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 458 members 6,339 guests
Please welcome our newest community members: