cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Kosenurm
Super User
Super User

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
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,838)