web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Avoid saving duplicate...
Power Apps
Unanswered

Avoid saving duplicate records to a SharePoint list

(0) ShareShare
ReportReport
Posted on by

Good day

 

I have an "Event booking app" and need to check 2 fields when submitting to the SharePoint list - i.e. the Date field and the Time field.  One should not be able to submit if those 2 fields have identical data in it.

janineb_0-1706692581142.png

Also, can you perhaps help me with the delegation warning on the gallery?  

Sort(Filter(EventBookingSlots,Date=DatePicker1.SelectedDate), StartTime.Value,SortOrder.Ascending)

 

Thank you

 

Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2026 Season 1 on at

    hey @janineb 

     

    can you please copy /paste the code from the screenshot so we do not need to retype?

     

    thanks in advance

  • janineb Profile Picture
    on at

    OnSelect of the Submit button:

    If(Value(StartTimedd.SelectedText.Value)>Value(EndTimedd.SelectedText.Value),Notify("End Time cannot be less than Start Time",NotificationType.Error), Patch(EventBookingSlots, Defaults(EventBookingSlots),{Date: DatePicker1.SelectedDate, StartTime: StartTimedd.SelectedText, EndTime: EndTimedd.SelectedText, Title: DetailsTxt.Text, EventName: EventnameLbl.Text, Venue: VenueTxt.Text}))

     

    On the gallery:

    Sort(Filter(EventBookingSlots,Date=DatePicker1.SelectedDate), StartTime.Value,SortOrder.Ascending)

  • mmbr1606 Profile Picture
    14,605 Super User 2026 Season 1 on at

    please try this instead:

    If(
     Value(StartTimedd.SelectedText.Value) > Value(EndTimedd.SelectedText.Value),
     Notify("End Time cannot be less than Start Time", NotificationType.Error),
     If(
     CountRows(
     Filter(
     EventBookingSlots,
     Date = DatePicker1.SelectedDate,
     StartTime = StartTimedd.SelectedText,
     EndTime = EndTimedd.SelectedText
     )
     ) > 0,
     Notify("Event with the same Date, Start Time, and End Time already exists.", NotificationType.Error),
     Patch(
     EventBookingSlots,
     Defaults(EventBookingSlots),
     {
     Date: DatePicker1.SelectedDate,
     StartTime: StartTimedd.SelectedText,
     EndTime: EndTimedd.SelectedText,
     Title: DetailsTxt.Text,
     EventName: EventnameLbl.Text,
     Venue: VenueTxt.Text
     }
     )
     )
    )

     

    and this for ur other issue:

    Filter(EventBookingSlots, Date = DatePicker1.SelectedDate)

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • janineb Profile Picture
    on at

    Thank you for the guidance, however I am getting this error:

    janineb_1-1706694991073.png

    Also, for the gallery - I need to sort the time in descending order for that specific day so I cannot use

    Filter(EventBookingSlots, Date = DatePicker1.SelectedDate)

     

     

     

  • mmbr1606 Profile Picture
    14,605 Super User 2026 Season 1 on at

    this is no error, its a delegation warning.

     

    you can set the delegation limit in the app settings to 2.000 entried (per default its 500).

    if you are below the 500 or 2000 entries this should work without problems.

     

    what is the gallery in your app called?

  • janineb Profile Picture
    on at

    The gallery is called "galOverview".

     

  • mmbr1606 Profile Picture
    14,605 Super User 2026 Season 1 on at

    you can try to just put FilteredEvents in your items Property of your gallery

     

    there only the items of the collection called FilteredEvents will show

     

    Let me know if my answer helped solving your issue.

    If it did please accept as solution and give it a thumbs up so we can help others in the community.



    Greetings

  • janineb Profile Picture
    on at

    On this part of your code, I am not too worried about the Delegation warning - but it complains about incompatible type for comparison.  It also says "Countrows" is not supported by this connector

     

     

    janineb_0-1706696897235.png

     

  • mmbr1606 Profile Picture
    14,605 Super User 2026 Season 1 on at

    please try the modified approach:

    If(
     CountRows(
     Filter(
     FilteredEvents,
     StartTime = StartTimedd.SelectedText,
     EndTime = EndTimedd.SelectedText
     )
     ) > 0,
     Notify("Event with the same Date, Start Time, and End Time already exists.", NotificationType.Error),
     Patch(
     EventBookingSlots,
     Defaults(EventBookingSlots),
     {
     Date: DatePicker1.SelectedDate,
     StartTime: StartTimedd.SelectedText,
     EndTime: EndTimedd.SelectedText,
     Title: DetailsTxt.Text,
     EventName: EventnameLbl.Text,
     Venue: VenueTxt.Text
     }
     )
    )
  • janineb Profile Picture
    on at

    Unfortunately I am still getting an error - the system does not seem to recognise "FilteredEvents"

     

    janineb_0-1706697482476.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 76 Most Valuable Professional

#2
Haque Profile Picture

Haque 69

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard