cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
calvares
Kudo Kingpin
Kudo Kingpin

Overbooking in a bookings app

I have a shuttle bus booking app which has been in use for a few months now. 

The fields are Your name (pre-populated), Date (of travel), Direction of travel and, depending on the direction, the time. 

There is a limit of 19 seats per bus. To do this, I have a hidden gallery which filters the bookings for the selected bus (date/time/direction). Once the user selects the time, a text box appears with the current number of bookings on that bus.

calvares_1-1625563795013.png

 

The save button is disabled If(CountRows('Gallery-SelectedBus'.AllItems)>= 19.

There is also a message that appears to say the bus is full using this formula.

calvares_0-1625563535432.png

 

This usually works but very occasionally, as you can see in this picture, a booking will come through that goes over the limit.

I've done lots of testing to see why this might be and I think sometimes, if the connection is slow, there will be a very short delay in the gallery updating. In that time the save button will be enabled so that someone can quickly book.

This is obviously not ideal but I can't think of any solution.

 

Has anyone got a similar system and have any ideas on how to get around this problem?

1 ACCEPTED SOLUTION

Accepted Solutions

Thanks @Tapesh . I did try this but there was still a delay since the gallery always needs to update after the user selects the date. It's all on one screen too. 

 

What I've done instead is added a container which covers the save button. OnChange of the time drop down, a timer starts for 8 seconds which brings up this 'checking bookings' sign:

 

calvares_0-1625734559757.png

 

It's not ideal but at least it means no one can click on the submit button whilst the data is updating.

 

View solution in original post

4 REPLIES 4
Tapesh
Post Prodigy
Post Prodigy

Hi @calvares , 

Yeah there is a play around with this as I know sometimes if you have that issue of updating and rendering the data in a flick, and powerapps has these limitations to a certain extent, however, if you think this is a performance issue you can raise a ticket for this, but if you need a solution to work around and make user stop booking if its out of seats, you can do so by adding small functionality.

To do so, 

change the disabled mode of your save button from gallery items to an error message which shows the bus is full. 
For example:

If(LableError.visible = true, disable save button, else show )

 By this, it won't check twice all the items and won't take time to render output, else if you want you can create a tempcollection  to get the number of rows already present, 
To do so 
You can create a temp collection on the start property of the app
or else 
best if to create temp collection on the visible property of the app, and set variable to countrows, and use the same all throughout the completion of the form. 

clearcollect(collectionName, datasource);
CountRows(Collectionname) //for collection
CountRows(Gallery.allItems) //if using gallery 


By this, you getting a row/application number when a person clicks on the form to submit or fill, and another thing is your app gets time to render the data and pass it to XYZ value.

 

 

"Please do not forget to give kudos if you find the suggestion helpful or Accept it as a solution if works fine to help other users to find it useful. "

 

 

 

Hi @Tapesh 

Thank you very much for your suggestions. So is the idea that if I create a collection and have the variable count rows then this will update faster than a count rows function on the gallery where the data source is not local?

 

I have created a collection on the OnVisible of the screen and a count rows variable. I then changed the data source for my hidden gallery to the collection. This gallery has a filter on it based on the selections in the form. However this gallery is no longer updating. Am I missing something? Am I meant to get rid of the gallery and filter the collection every time a selection is made in the form?

Tapesh
Post Prodigy
Post Prodigy

Hi @calvares 

You do not have to get rid of the gallery or important parts, all that you need is to add clearcollect code to onVisible of the screen to get the number of rows, as shown below, 

Tapesh_0-1625650065010.png

Use the variable to compare the value/show hide details

and you will get the result as below, you can use the same variable to show the hide button or any of its true false property display mode, etc. 

Tapesh_1-1625650140824.png

 

 

 

"Please do not forget to give kudos if you find the suggestion helpful or Accept it as a solution if works fine to help other users to find it useful. "

 

 




Thanks @Tapesh . I did try this but there was still a delay since the gallery always needs to update after the user selects the date. It's all on one screen too. 

 

What I've done instead is added a container which covers the save button. OnChange of the time drop down, a timer starts for 8 seconds which brings up this 'checking bookings' sign:

 

calvares_0-1625734559757.png

 

It's not ideal but at least it means no one can click on the submit button whilst the data is updating.

 

View solution in original post

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,736)