web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / collect or clearcollec...
Power Apps
Answered

collect or clearcollect multile selected items from gallery for further update

(0) ShareShare
ReportReport
Posted on by 102

Hi 

 

I have gallery with checkbox to select items from gallery.

1. I was thinking to use Collect or ClearCollect to get items from the gallery.

When I make ClearCollect(Gallery.Selected), it returns collection with first row, regardless of if no checkboxes or other than first row are selected with checkbox.

When I make ClearCollect(Gallery.AllItems), it returns collection, but my checkbox record is unclear to me. (Default value for checkbox is false)

Dulat_0-1691822049534.png

 

Can someone help me with this?

 

Plans to use collection.

2. to update Status column to "delete" for this collection.

3. to update rows in data source from step1 by new status from step2.

If you can help me with this, also very appreciated.

 

Thanks!

 

 

 

 

 

Categories:
I have the same question (0)
  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @Dulat  ,

     

    You want to update the status for the records for which the checkbox selected is true? If yes please use the below code.

    ForAll(
     Gallery1.AllItems,
     Patch(
     'Course list',
     ThisRecord,
     {
     Status: If(
     Checkbox2.Value = true,
     "Approved",
     "Declined"
     )
     }
     )
    )

     

    Thanks,

  • Dulat Profile Picture
    102 on at

    Hi @SanmeshG Thanks for reply!

     

    I am new in powerapps.

    Could you please advise what are 'Course List' and ThisRecord mean in this context?

    Is it column and datasource?

    Thanks!

  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @Dulat ,

     

    'Course List' is my SharePoint List in this case and ThisRecord is the current record that is running (or is being used) in that context.

  • Dulat Profile Picture
    102 on at

    Thanks a lot!

  • Dulat Profile Picture
    102 on at

    Hi @SanmeshG 

     

    In this code, anything not selected by checkbox goes to Else condition, so labelled accordingly.

    Is there any way to do similar thing but only for selected items. unselected should remain same.

     

  • SanmeshG Profile Picture
    1,947 Moderator on at

    Hi @Dulat ,

     

    If you want to patch only the selected record and not all then you can use the patch function.

    Pacth(Datasource,Gallery1.Selected,{columnName:"sampleText"})

    ForAll should be used only if you have changes made in multiple records and you want to patch them. 

    Hope this helps.

  • Verified answer
    Dulat Profile Picture
    102 on at

    Thanks @SanmeshG 

    I found this video, where Shane is doing exactly what I was looking for. 

    Select multiple records in a gallery and Patch with the PowerApps ForAll function - YouTube

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 361

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard