Hello guys,
I'm sure you find the subject of this post super sexy.... And you're all going to love scratching your head around it...
Something cool I want to achieve here but struggling a bit between shaping a collection that I'm looping into through another table...
Here is the thing:
1 - A user is going to select from a date picker a start date and an end date out of which I make a collection showing every day within the range he selected (PLEASE SEE COLLECTION1 PIC).
2 - Based on the selected start date and end date, I create another collection that is returning from the SP list source, all the desks that are reserved during those days (even if they are in between, or overlapping). (PLEASE SEE COLLECTION2 PIC).
In order to achieve that I'm using this formula (not that it can be any useful for you but we never know):
ClearCollect(ColBookingsForSelectedDays, Filter('Desk Reservations', Office = SelectedLocation, Or(startTime >= 'Check In' && startTime <= 'Check Out', endTime >= 'Check In' && endTime <= 'Check Out')))
Here is what I try to achieve and I'll use a simpler syntax like PowerShell for better understanding:
ForEach (day in collection1.Date) {
ForEach (booking in collection2) {
If (date in booking) {
If not exist (AddColumn in Collection1 "numberOfBooking");
append value "+1" in row where column "Date" = day
}
}
}
As you probably understand, the goal is to calculate the number of reservations for each day in the date range that the user selected in the date picker, by querying the source (SP list) for each of these days.
If the office occupancy is reached, then the app should return a message saying:
"The office is full at the date $Date, please choose a different date".
I'm not sure if I can "dynamically" create a new column and append a value to eat while looping into it in the same time in a different column if it...
Thank you very much in advance!