Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Duplication in SharePoint backend.

Posted on by 41

Hi.
I know there are quite a few instances of very similar questions (here's one) but I can't find any that help me progress with my issue.
I've created a booking system for hot desks and parking spaces with a filter on the available desks and parking spaces (SharePoint Lookup columns connected to dedicated SharePoint lists), driven by the SelectedDate in a Date Picker control.
That's all working nicely but when I tested two users selecting the same options from the drop downs for the same date, both items were successfully written (patched) to the backend list.

My question is, how do I modify my Submit button code to do a quick, final check that the selections are still valid before 'patching' the values into the list?
Is that the best solution to this?
I've tried a ClearCollect based on the same filter values in the drop downs, just to see if the filtered items available can be pulled into a 'Collection' as well as being used as the 'items' in the drop down boxes, but the results don't match and I can't see why.
I'd also struggle to construct the If statement if the selections made were found to be in the list already.
Can anyone spare the time to help a newb out?
Here's a screen shot of the Submit code...

N03L_0-1671197642129.png

 

and here's the existing filter on one of the drop down boxes. They're identical in all but name...

N03L_1-1671197728755.png

(thanks to @cha_cha for the guidance on the filters)

Thanks in advance.
N03L.

Categories:
  • N03L Profile Picture
    N03L 41 on at
    Re: Duplication in SharePoint backend.

    Thanks.
    Love the Marty Feldman 'obsession' by the way.
    Nice to see the classics being kept alive.

  • Drrickryp Profile Picture
    Drrickryp 30,510 on at
    Re: Duplication in SharePoint backend.

    @N03L 

    Anything is possible in this best of all possible worlds.

    raining.gif

     

  • N03L Profile Picture
    N03L 41 on at
    Re: Duplication in SharePoint backend.

    Thank you so much @Drrickryp 
    You're a wonderful human being. 😊

    I've got past that issue but have not managed to recreate the problem since implementing your fix.
    It now seems to automatically select the next available pair of values from the lookup lists that the drop downs are connected to and just completes the 'Patch' with those values rather than display the 'Notify' text.
    As I'm trying to troubleshoot that, I thought to add the values that are being passed on the confirmation screen (I don't know why I didn't think to do that before but...) and it's intermittently holding those values and, more often than not, resetting them to their defaults after displaying them correctly for less than a second.
    I have got a 'Reset' function on the back button but this is happening before that's pressed.
    Any ideas how or why this might be intermittent if not why it's happening at all?
    I hate intermittent!

    Thanks again.
    N03L


    EDIT:
    The '
    Notify' text has just shown up for the first time today, and the 'Patch' behaviour was halted, as expected, but from a different laptop.
    Could something be cached on the laptop I've been building the app on?

  • Verified answer
    Drrickryp Profile Picture
    Drrickryp 30,510 on at
    Re: Duplication in SharePoint backend.

    @N03L 

    Basically it would be 

     

    If(
     IsBlank(
     LookUp(
     yourlist, Desk.ID=Dropdown_Desk.Selected.ID && 
     'Parking Space'.ID= Dropdown.Parking.Selected.ID &&
     Reservation_Date=Datepicker.SelectedDate
     )
     ), Patch(... ,
     Notify("This space and desk is already scheduled for someone else", Error
     )
    )

    for both desk and parking space.  If it were either/or then the formula would be different.

     

     

  • N03L Profile Picture
    N03L 41 on at
    Re: Duplication in SharePoint backend.

    Is bumping still allowed on the internet?
    I don't want this to get lost due to people focusing on what's been posted more recently.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,591

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 64,090

Leaderboard