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.
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.
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?
Solved! Go to Solution.
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:
It's not ideal but at least it means no one can click on the submit button whilst the data is updating.
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?
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,
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.
"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:
It's not ideal but at least it means no one can click on the submit button whilst the data is updating.
User | Count |
---|---|
162 | |
84 | |
70 | |
64 | |
62 |
User | Count |
---|---|
208 | |
147 | |
95 | |
84 | |
68 |