Hitting a bit of a wall here. Could would your great expertise.
App: Creates an entry to put customers name, then selected the garage door number from a drop down from 1-10. Another screen allows another use to see which doors are ocupied and open.
Issue: Trying to dynamically change the values of the dropdown so if a door is already ocupied you dont have double selection. Would be great to prevent user from selecting the door number by not showing that door on the drop down or an error message.
I've already tried to do due diligience and research this extensively but not yet achieved the fix. Let me know if you guys can think of a way to resolve this.
ps. I have a warning sign validation to show red if there are 2 customers on a garage door but the goal is to prevent this from happening at all from a coding standpoint.
It sounds like you're trying to replicate record locks across different instances of your app, something SharePoint (to my knowledge) doesn't do for you OOTB.
But, theoretically, you should be able to *nearly* replicate the functionality if you had a "CheckedOut" field added to your list of Doors.
In the OnVisible event of the screen, collect your Doors using ClearCollect, only getting the ones where it is both NOT assigned and NOT checked out
Assign your combobox to get its items from the created collection
In the OnSelect event of your combobox, run the same ClearCollect to re-check and populate your list
In the OnChange event of your combobox, use a Context Variable ("LocalDoor") to hold the currect door selection:
......(1) if the LocalDoor variable is NOT blank, then patch the datasource to alter the existing Door selection (in the LocalDoor variable) to set the "CheckedOut" field to be 'false'
......(2) use UpdateContext to store the door selection to LocalDoor
......(3) if LocalDoor is NOT blank, then patch the datasource to alter the "CheckedOut" column to 'true' for that newly selected door
Lastly, when you leave the screen, write the Assigned field for the Door, and set the CheckedOut column to 'false'.
There are still holes in that... not least of which is the potentiality that a door could get permanently "CheckedOut" if someone picked the door but then walked away from their device, or just closed the app. Perhaps you could add a time-stamp to the check-out process, and modify the Collect function to pull Doors where they are (1) not assigned and not checked out, or (2) not assigned but they ARE checked out BUT the check-out time stamp is long enough ago that we release it. Then you could add a Timer control to your form, set its length to be the duration of the "Lock" you will allow, and start it when the person "Checks out" the Door (in the OnChange event of the combobox). If the user remains on the screen long enought to let the timer end, it Patches the datasource to set the CheckedOut property for the selected door to be 'false' and Resets the combobox.
But maybe someone can improve on this... or suggest an alternative.