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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Create row items from ...
Power Apps
Unanswered

Create row items from a gallery using checkbox

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

 

I have created a gallery with a checkbox for each items in the gallery list.

The idea is that the checkbox is used to select the items (it can be multiple!). 
Once selected there will be a button to duplicate the selected items. Also, I am using dataverse as my datasource.


Below is a snippet of my code,

ClearCollect(RecordsToCopy, DropColumns(BudgetMonthRecord.'Forecast Items',"_ownerid_value","createdby","modifiedby"));
Clear(NewRecords);

// collect new records into collections
Collect(NewRecords, RecordsToCopy);
Patch('Forecast Items', NewRecords);

Concurrent(
 Clear(NewRecords),
);

 

I wanted to create a collection for only the selected item. Would appreciate the help for this!
Thanks.

- Mia

Categories:
  • Ashwin7104 Profile Picture
    671 on at

    Hey @Anonymous ,

     

    Please use below code to filter selected item from gallery. Please note that schema in collection and Dataverse table should be identical in terms of column names.

     

    // collect selected records in gallery into collections
    ClearCollect(collectionName, Filter(Gallery.AllItems,Checkbox.Value = true))
    
    //Use Patch / Collect to create items
    Patch('Forecast Items', NewRecords);

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Ashwin7104 ,

    I tried your solution, and this would be use in the onSelect property of the button, yes?
    Unfortunately the item is not created and I am not sure what went wrong for this?

    // collect selected records in gallery into collections
    ClearCollect(RecordsToCopy, Filter(ForecastGallery.AllItems, Checkbox1.Value = true));
    Clear(NewRecords);
    
    // collect new records into collections
    Collect(NewRecords, RecordsToCopy);
    
    // create the new records in batch
    Patch('Forecast Items', NewRecords);

     

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @Anonymous ,

     

    You can try below formula if it helps your requirement. 

     

    ForAll(Filter(ForecastGallery.AllItems,Checkbox1.Value = true), Patch('Forecast Items'),Defaults('Forecast Items'),{ColumnName: ThisRecord.CollectionColumnName,.....})

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard