I am trying to check a SharePoint list column value before having data be submitted. The column is a simple Number field that will be counting down to 0 as users submit data.
To elaborate: It's essentially an appointment booking system that doesn't use forms in any way - just text inputs and gallery selections. I'm having a difficult time trying to account for not having the data in "real time" where two users could essentially select an appointment that only has 1 slot remaining and double book it. I know this can be accomplished with a simple refresh timer, but that has it's own problems with performance and doesn't really look great with the constant loading dots at the top of the screen.
All I'm trying to accomplish is to have a "loading spinner" type deal that triggers on screen for the user, goes and checks this column called "Slot Count", and if the value is not 0 to submit the data. If the value is 0 I want it to stop, inform the user that the appointment is full, and allow them to select another one. I tried to use LookUp with IsBlank but either I'm not doing it correctly or it won't work for this scenario.
List information:
"Vaccine Appointments" with two columns - "Time" and "Slot Count"
Relevant Screens:
"Appointment Selection" with a gallery pulling from the above SharePoint list. Has a button under each time slot to select the appointment and go to the next screen called "Appointment Confirmation."
"Appointment Confirmation" with labels displaying appointment information and a confirm button to then do the check and submit the data as long as the slot count isn't 0. If the slot count is 0, it'll inform the user with a popup and once they select OK it'll return to the "Appointment Selection" screen.
Thanks!
Yes, the Lookup function will return whatever is in the 3rd argument if it is able to find a record matching your criteria. So, the simple trick here is...put a true in the 3rd argument. If the record is found then Lookup will return true, otherwise false.
Looks like I was pretty close to this already! I guess I didn't need the IsBlank portion and I didn't really understand what the result part of the LookUp function was. This worked perfectly, thank you!
If other users are impacting the same record in the list, then you will need to refresh the datasource before submitting. Even then you are not guaranteed that it will be correct (i.e. another user could be decrementing the number to 0 immediately after you refresh the data).
You can, however, check on the value being 0 or not with a simple lookup.
LookUp(yourList, <otherCriteria> && NumberColumn=0, true)
This will return a true if that condition is met.
I hope this is helpful for you.
WarrenBelz
146,645
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
65,997
Most Valuable Professional