cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Post Partisan
Post Partisan

Date Picker - countdown for bookings

Hi there, 

 

I have an app whereby user's can select a delivery date from a standard date picker control, but we want to limit the amount of times people can select a delivery date to 75. 

 

How can I implement the logic below so that, once the chosen date has been selected 75 times, the user receives an error message saying that no more bookings are available for that date?

 

The data coming from the app is being loaded into a Dataverse table, so could I do a LookUp count to that date column in that and if it's got more than 75 entries, show an error? 

 

Thanks

K. 

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Kosenurm ,

Something like this

If(
   CountRows(
      Filter(
         TableName,
         YourUserField=User().FullName &&
         YourChosenDate = YourDatePicker.SelectedDate
      )
   ) >75,
   Notify(
      Your error message",
      Error
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

View solution in original post

3 REPLIES 3
WarrenBelz
Super User
Super User

Hi @Kosenurm ,

Something like this

If(
   CountRows(
      Filter(
         TableName,
         YourUserField=User().FullName &&
         YourChosenDate = YourDatePicker.SelectedDate
      )
   ) >75,
   Notify(
      Your error message",
      Error
   )
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Thanks, I am getting error "Behavior function in a non-behavior property. You can't use this property to change values elsewhere in the app" for the Notify element???

 

I amended your code to...

 

 

If(CountRows(Filter('TableName'.'ColumnName', yourchosendate = NewDatePicker_1.SelectedDate))>75, Notify("This date is unavailable, please choose another date"), Error));

 

 

K.

Thank you for the code it works. I was originally using it on a text label rather than the date picker itself. All good now.

 

Thanks again

K.

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (4,520)