cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Ryan_B
Regular Visitor

Check SharePoint list column value before submitting data

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!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@Ryan_B 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

3 REPLIES 3
RandyHayes
Super User III
Super User III

@Ryan_B 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

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!

RandyHayes
Super User III
Super User III

@Ryan_B 

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (47,708)