
Hi Community,
I'm having 2 tables. 1 is products and another is versions. each product is tied up with version using product id column. once a product is created i've to tag it to the version. and we're allowing user to copy the selected items from a gallery(which is sql view with products + versions) which will have list of products.
1. on selection of products i'm collecting the products to a separate collection
2. then on click of copy product button. I'm using the following formula
ForAll(
colSelectedItems,
Collect(
colProdCopy,
LookUp(
dbo.Products,
ID = colSelectedItems[@Product_ID]
)
)
);
ClearCollect(colVerCopy,
ForAll(
colProdCopy,
Patch(
dbo.Products,
Defaults(dbo.Products),
{
Product_Name: colProdCopy[Product_Name],
Brand: colProdCopy[@Brand],
}
)
).ID);
RenameColumns(colProdCopy,"ID","Product_Versions_ID");
Patch(
dbo.Versions,
AddColumns(
colVerCopy,
"Version",
"1.0",
"CreatedDt",
Now(),
)
);
Here I'm trying to collect the newly created product ID's from the patch into a collection. somehow i'm not able to get the ID's it's throwing error. any thoughts. what i'm doing wrong here. or is there any other process to achieve this ?