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
Hey @anonymia25 ,
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);
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);
Hi @anonymia25 ,
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.
If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.
User | Count |
---|---|
253 | |
113 | |
92 | |
48 | |
38 |