Hi all,
I have a Book button to book a desk.
How to limit number of bookings (total 1 or total 2) during the day?
Hi @AJ_Z
I just noticed that @StalinPonnusamy has popped in to offer assistance reply @AJ_Z to me if you still need me 🙂 . But i am sure he is able to assist. -> My question is open for everyone ^^. thank you so much, I'm still need your help.
Step Two: change the label's Visible property to: CountRows(Filter(Datasource,User.Email = User().Email && RelatedDate = Today()))>=2
-> I have tried your code as below
CountRows
(Filter
(Datasource,
Employee.Email = UserInfo.Email &&
DateValue(Text(selectedEndDate,DateTimeFormat.ShortDate)) = FromDate)) < 1
but I'm getting the message:
Delegation warning. The highlighted part of this formula might not work correctly on large date sets. The "CountRows" operation is not supported by this connector.
For First, you can combine your current code like -> Yes, I'm using the same the code
If
(
!IsBlank(LookUp(DeskBooking,Employee.Email = UserInfo.Email && MySlotTime)), DisplayMode.Disabled,
!IsBlank(LookUp(DeskBooking,MySlotTime && Title = MainGallery.Selected.Title)), DisplayMode.Disabled
)
For Second, I have tried to use the code but it's not working
Behavior function in a non-behavior property. You can't use this propert to change values elsewhere in the app.
Delegation warning. The highlighted part of this formula might not work correctly on large data sets. The "CountRows" operation is not supported by this connector.
The function 'If' has some invalid arguments.
--
The Book button / Visible:
UpdateContext({IsMorethan2Bookings : false});
ForAll(DateDiff(Calendar_1.StartDate, Calendar_1.EndDate),
If(CountRows(
Filter(OfficeBooking_1,
Employee.Email = UserInfo.Email && FromDate = DateAdd(Calendar_1.StartDate, ThisRecord.Value,Days)
)) >= 2,UpdateContext({IsMorethan2Bookings : true});
) //If
); //ForAll
If(IsMorethan2Bookings, Notify("You can't book more than two desks in single day"),
Patch(.....)
)
I just noticed that @StalinPonnusamy has popped in to offer assistance reply @AJ_Z to me if you still need me 🙂 . But i am sure he is able to assist.
Is this a displaymode if statement for a different reason or for the same issue. if it is for a different thing i know just where to insert our bit but if you are attempting to resolve the same thing we will likely just need to replace it 🙂 . Also is MySlotTime a column in the datasource and is it date only or date and time if so or is it some other data type. This will help me understand the situation so we can adapt my suggestion 🙂
Hi @kinghnvn
First, you can combine your current code like
If(
!IsBlank(LookUp(DeskBooking,Employee.Email = UserInfo.Email && MySlotTime)) ||
!IsBlank(LookUp(DeskBooking,MySlotTime && Title = MainGallery.Selected.Title)),
DisplayMode.Disabled,DisplayMode.Edit
)
Second, You are using Calander control which has a Date Range so Changing your current display mode may be challenging since we need to loop through the selected dates to check each date.
So, We need to validate this logic on the "OnSelect" of the Book button.
Logic concept
UpdateContext({IsMorethan2Bookings : false});
ForAll(DateDiff(Calander1.StartDate, Calander1.EndDate),
If(CountRows(
Filter(OfficeBooking,
EmployeePerson.Email = UserInfo.Email && BookingDate = DateAdd(Calander1.StartDate, ThisRecord.Value,Days)
)) >= 2,UpdateContext({IsMorethan2Bookings : true});
) //If
); //ForAll
If(IsMorethan2Bookings, Notify("You can't book more than two desks in single day"),
Patch(.....)
)
Thanks,
Stalin - Learn To Illuminate
I'm using DisplayMode for the Button as below.
How to combine your code?
If(
!IsBlank(
LookUp(
DeskBooking,
Employee.Email = UserInfo.Email && MySlotTime
)
),
DisplayMode.Disabled,
!IsBlank(
LookUp(
DeskBooking,
MySlotTime && Title = MainGallery.Selected.Title
)
),
DisplayMode.Disabled
)
I would do this utilising DisplayMode for the button, a Label for user journey and a countrows with a filter.
Step One: change the button's DisplayMode to If(CountRows(Filter(Datasource,User.Email = User().Email && RelatedDate = Today()))>=2, DisplayMode.Disabled,DisplayMode.Edit)
Step Two: change the label's Visible property to: CountRows(Filter(Datasource,User.Email = User().Email && RelatedDate = Today()))>=2
Step Three: change the label's text to something like. "You cannot Book more than Two Desks in one Day"
Ensure you tweak my formula to matchup with your datasource an situation. everything in red probably needs to be changed the blue part for Today() may need to change if they are using a dataselector to book for the future.
If you need more help on how to apply this to your circumstance please provide the name of the Datasource and the column name / column type referencing who booked it. Then also let me know how they are picking the day is it a DataSelector or always Today()
WarrenBelz
146,651
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,999
Most Valuable Professional