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 / Check if the date exis...
Power Apps
Answered

Check if the date exists in a table

(0) ShareShare
ReportReport
Posted on by 141

The next line will notify you if a date already exists in my table when I press OK in my form

 

If(IsBlank(LookUp(Filter('kitchen.cycles',Active=true),Date=DataCardValue2_1.SelectedDate )),
SubmitForm(EditForm1_4),Notify("This date has already been entered, edit the Date or put the old one inactive",Error))

 

The rule works.

 

The disadvantage is only if I do not change the date and press OK that the message also comes that the date already exists.

How can I prevent this? So always the message if the date exists, but not if the date is the same as stated in the form.

Categories:
  • WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @rho1967 ,

    Firstly you can do the lot with a Lookup (you do not need to Filter), but the code

    If(
     IsBlank(
     LookUp(
     'kitchen.cycles',
     Active && Date=DataCardValue2_1.SelectedDate
     ).Date
     ),
     SubmitForm(EditForm1_4),
     Notify(
     "This date has already been entered, edit the Date or put the old one inactive",
     Error
     )
    )
    

    should only show the error is there is not an active record with the Date field (not a good name for a field - this blog of mine may be of interest to you) containing the date from the date picker. What do you mean by "change the date"

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

  • rho1967 Profile Picture
    141 on at

    Hi Warren,

    Thanks for the answer. What I mean by change the Date .

     

    Example: I have a Date=01/01/2022 in my form if the date changes to for example 01/02/2022 then he has to check the table if this date already exists.

    If the Date remains 01/01/2022, then he must complete a submit form because it is the same date.

  • Verified answer
    WarrenBelz Profile Picture
    156,528 Most Valuable Professional on at

    Hi @rho1967 ,

    Set a Variable on the OnChange of the Date Picker

    UpdateContext({varNewDate:true})

    At Screen OnVisible 

    UpdateContext({varNewDate:false})

    Your save code 

    If(
     IsBlank(
     LookUp(
     'kitchen.cycles',
     Active && Date=DataCardValue2_1.SelectedDate
     ).Date 
     ) && !varNewDate,
     SubmitForm(EditForm1_4);
     UpdateContext({varNewDate:false}),
     Notify(
     "This date has already been entered, edit the Date or put the old one inactive",
     Error
     )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    Visit my blog Practical Power Apps

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard