Hi everyone,
I am working on a shopping cart system to book ressources in a room. There is an issue, that people are able to book the same ressource twice, if they both have the "available Ressource" screen open and choose the same ressource for a lapping time frame at the same time. This occurs, because the gallery data does not refresh every second or so, only when people change the screen, or trigger an event. I think this would'nt be good for permformance reason also and if i refresh the screen, the check box of the selected ressources also resets.
So the idea was, when adding the ressources to the shopping cart, the app checks within the SharePoint list, if an item already exists with the same date (or time frame) and Desk name. If yes, please send an error message, else create a new item in the list. This is my current code, but it only works, if I check the exact dates and not the critical time frame, meaning "DeskText = Desk.Title && 'Check Out From' = startTime && CheckOutTo = endTime" works, but not the entire formula:
ForAll(selectedDesks As Desk, If(!IsBlank(LookUp('Desk Reservations', DeskText = Desk.Title && 'Check Out From' >= startTime && CheckOutTo <= endTime || 'Check Out From' <= endTime && CheckOutTo >= endTime)),
Notify("Ressource not available any more, please check your shopping cart")));
ForAll(selectedDesks As Desk, If(IsBlank(LookUp('Desk Reservations', DeskText = Desk.Title && 'Check Out From' >= startTime && CheckOutTo <= endTime || 'Check Out From' <= endTime && CheckOutTo >= endTime)),
Patch('Desk Reservations',
Defaults('Desk Reservations'),
{
Title: currentUser.FullName & " " & Desk.Title,
DeskText: Desk.Title,
CheckOutFrom: startTime,
CheckOutTo: endTime,
DeskGroup: Text(Desk.Tischgruppe),
Comment: CommentInput.Text,
Shopping_Cart: "Yes",
ReservedBy: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & currentUser.Email,
Department: "",
DisplayName: currentUser.FullName,
Email: currentUser.Email,
JobTitle: "",
Picture: ""
}
})));
Could you please help, because this is a critical business case.
Thank you!

Report
All responses (
Answers (