hiya,
i have a been building an online store . i have 2 tables, product and orders and the patch creates a new item into the order table when a new item is submitted.
ive being using this code below and it creates an entry for each item However if a user buys more then 2 items, it creates an order id code, twice. How can i update the code so it reflects if there is more then 2 items it uses the same id?
Set(VarID,Coalesce(Max('Order Details', Value(Right('ID ', 4))), 0));
Patch(
'Order Details',
Defaults('Order Details'),
{ 'ID ':"OID" & Text(VarID + 1, "0000"),
Name: GalCheckOut.Selected.Title,
'Product Color': GalCheckOut.Selected.Color,
'Order Size': GalCheckOut.Selected.SIZE,
'Item Total': GalCheckOut.Selected.PRICE,
Qty: GalCheckOut.Selected.QTY,
'Order Total': GalCheckOut.Selected.SUBTOTAL,
'Ordered By': txtCustomerName.Text
}
);Clear(colShoppingCart); Navigate(Welcome)