Hi Todd,
Thank you for choosing Mictosoft Community.
You can achieve this by using a similar approach to your existing ForAll and Patch functions, but tailor it to your specific tables and relationships.
Here’s a step-by-step guide to help you clone a record in the Quote Line Item Calcs table:
Identify the Record to Clone: First, identify the record in the Quote Line Item Calcs table that you want to duplicate.
Use ForAll and Patch Functions: Use these functions to duplicate the record. You’ll need to adjust the fields and tables accordingly.
Here’s an example of how you might write the query:
ForAll(
Self.Selected.AllItems,
Patch(
'Quote Line Item Calcs',
Defaults('Quote Line Item Calcs'),
{
'Quote Line Item': ThisRecord.'Quote Line Item',
'Quantity': ThisRecord.Quantity,
'Price': ThisRecord.Price,
'Total': ThisRecord.Total
}
)
)
In the example above:
Self.Selected.AllItems refers to the items selected in your editable grid.
Patch is used to create a new record in the Quote Line Item Calcs table.
Defaults('Quote Line Item Calcs') initializes a new record.
The fields inside the curly braces {} are the ones being duplicated from the selected record.
Allow User to Edit Quantity: After duplicating the record, the user can go back and edit the Quantity field as needed.
This approach avoids using a flow and should be faster. Make sure to adjust the field names and table names to match your actual schema.
If you have any specific constraints or additional requirements, feel free to share them, and I can help refine the solution further!
If this fixes the issue, please mark as resolved to help others with find it.
Happy to help
Robu 1