cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Labraham36
Helper II
Helper II

Data repeat restriction

Hello community! I have a doubt. I am creating an app that basically what it does is take a date and a data (Number of hours worked), no more than that. What I would like is that, if the user enters a date that he has already entered before, the App does not allow him to advance. Basically the date field cannot repeat dates. Is there a way to do this? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@Labraham36 ,

YourDateField refers to the field name in your List, not the control name on the screen.

 

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.

View solution in original post

6 REPLIES 6
WarrenBelz
Super User III
Super User III

Hi @Labraham36 ,

When you refer to "entered before", is this contained in a List which also contains the user's details. If so, you would do a Lookup on the list on the OnChange of the Date Picker (note you will get a Delegation warning on this)

If(
   !IsBlank(   
      LookUp(
         YourListName,
         UserField=User().FullName && 
         Text(Self.SelectedDate,ShortDate)=Text(YourDateFiled,ShortDate),
      ).YourDateField
   ),
   Notify("Date used previously,Error);
   Reset(Self)
)

 

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.

Thank you for your answer! But I think I explained it wrong. The problem is the following: My App only receives two data, a date and a number of hours corresponding to that date. What I need is that when the user enters a new date, if by mistake he enters a date that has already been registered, and wants to save, the app does not leave it since there cannot be more than one record per date. My data is saved in an excel in one drive, so what the function should do is check in the date field of my excel and if the date that was entered and is going to be saved had been entered before, then no it should allow you to save the record. I hope my problem is better understood and in advance thank you very much for your time !!!

Hi @Labraham36 ,

The code I supplied should do that - it is checking for a the existence of a record where you have the user's name in one field and the date selected by the user in another field. If this record exists, the message pops up and the date picker is cleared.

 

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.

 

Sorry it's so annoying lol, but for some reason it's not working for me. Attached image to see that I may be writing wrong. In my case I must replace the "," by the ";" since in my region it works like this. Also remove the part of the code: "UserField = User (). FullName &&" since there is no user validation in my App, the only thing I need to verify is if the date is repeated.

 

Error 1.pngError 2.pngError 3.pngThanks!

@Labraham36 ,

YourDateField refers to the field name in your List, not the control name on the screen.

 

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.

View solution in original post

WarrenBelz
Super User III
Super User III

Hi @Labraham36 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

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.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,058)