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 / Generate restriction
Power Apps
Unanswered

Generate restriction

(0) ShareShare
ReportReport
Posted on by 95

Hello community!

 

I need help with the following: I have this formula in the record saving icon:

 

If (IsBlank (DateValue1_1); UpdateContext ({Enter_Date: true}); If (IsBlank (DataCardValue6_1); UpdateContext ({Enter_Hours: true}); If (DateValue1_1 exactin App_Hours.Date; UpdateContext ({No_Repeat_Dates: true}); SubmitForm (EditForm1) && Navigate ('Registry Update'; Fade))))

 

This formula evaluates several things in order to restrict incorrect data entry. This part of the code in particular: "If (DateValue1_1 exactin App_Hours.Date; UpdateContext ({No_Repeat_Dates: true});" evaluates whether a record already exists on that date and, if there is, prevents another record from being made on that date date, since by date the idea was that only one record can be entered. The problem is that now they have asked me to add a list field, being that now there can be several records per day, only that each record must correspond to only one status. Ex: For 01/01/2021 there may be a record with the status "Available", another with the status "Not available", etc. But what cannot be is the same day, have two equal states. How could I add that restriction? Thanks in advance!

 

Problema.png

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Labraham36 

    Your formula has some errors to it.

    1 - you are referencing things like DataCardValue1_1.  This is a control...it is not a property.  You need to reference the property of that control that you would like to determine if it is blank.  So, if it is a TextInput for example, then IsBlank(DataCardValue1_1.Text) is what you need to use.

    2 - same applies to the DateValue1_1...it is a control, you need to reference the actual property of the control which would be - DateValue1_1.SelectedDate

     

    I hope this is helpful for you.

  • Labraham36 Profile Picture
    95 on at

    Thank you very much for the advice ! I will take them into account for a better performance of my App, but the truth is that the code is working correctly. My problem is that I don't know how to compare the date with each state now. Something like:

     

    "If (DateValue1_1 exactin App_Hours.Date && DataCardValue6.Text exactin App_Hours.Process Type =" Prepared Guides "; UpdateContext ({No_Repeat_Dates: true});"

     

    Although this formula does not work, what you should do is look in the date field if there is a record with that date, if there is, it looks for if there is a record with that status on that date, and if both conditions are met, it does not leave have the user add the record. I hope my problem has been understood a little better. In advance, thank you very much for your help and interest "

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Labraham36 

    Can you tell me more about that the context variables are for?

    Also, what kind of column is Process?  You are now showing that in the formula where before you were looking at the Fecha (date) column for your comparison.  You need to match types properly in the formulas.  If you want to match for dates, then you need to use dates and not text.

     

     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 397 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 354

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard