I have written the below code while running the patch command, so that it can obtain max+1 for each records
Full code:
ForAll(
GalleryCartOrder.AllItems,
Patch(
WsOrderTables, Defaults(WsOrderTables),
{
RecoNo:(First(Sort(colAllWsOrders, RecoNo, SortOrder.Descending)).RecoNo)+1,
RefJobNo:Upper(TextBox2_21.Value),
IssueForModel:Upper(TextBox2_26.Value),
IssueForSerial:Upper(TextBox2_27.Value),
LineExtPrice:ThisRecord.CostPrice*Value(CartQty.Value)
}
)
);
Hi,
(First(Sort(colAllWsOrders, RecoNo, SortOrder.Descending)).RecoNo)+1
This part of your formula is static since the number of items in colAllWsOrders
So to implement this correctly, you need to store the patched item into the said collection to have a +1 in each iterration
ForAll(
GalleryCartOrder.AllItems,
Collect(colAllWsOrders,
Patch(
WsOrderTables, Defaults(WsOrderTables),
{
RecoNo:(First(Sort(colAllWsOrders, RecoNo, SortOrder.Descending)).RecoNo)+1,
RefJobNo:Upper(TextBox2_21.Value),
IssueForModel:Upper(TextBox2_26.Value),
IssueForSerial:Upper(TextBox2_27.Value),
LineExtPrice:ThisRecord.CostPrice*Value(CartQty.Value)
}
)
)
);
I guess something like this should works.
Regards,
WarrenBelz
146,660
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional