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

Restriction problem

Hello community! I have a query to see if someone can help me:

 

I have an App that records two data, a date and a number of hours that correspond to that date. The problem is (And I'm going crazy) that I need the user not to be able to repeat the date, since if or if the data of hours per day must be entered, and a day cannot have more than one data in number of hours . It occurred to me to carry out this restriction to make an if condition that before recording a record verifies if the date entered is equal to the value shown in the date field of the screen that allows "View records". The formula launches a warning message and that is why sometimes it works and sometimes it doesn't. Also, if I am in "Edition" mode, the restriction is always applied, regardless of whether the date for which I want to modify it is repeating or not. What could I do to solve this? I attach images to better understand my problem.

 

Problema 1.pngProblema 2.pngProblema 3.pngProblema 4.png

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @Labraham36,

Do you want to check if the selected date has already existed in your data source and avoid this repeated date submitted?

Could you please share a bit more about the scenario:

  1. What is the column type in the Excel table that you used to store the date, a general column?
  2. Make sure that if you want to check the selected date that has existed in your Excel table

From your previous case, I have found that you store all the data in OneDrive and I just assume that you store the date in a general column because this is indeed a suitable method.

In addition, you should not refer to the control name to compare two date which is wrong. You should refer to the real date value to compare with each other. I am not sure what is the DateValue2, which should not be a value in your app, it should be an existing date in your Excel table.

I have a test on my side, please take a try as below.

I store the date in a General column.

Set the OnSelect property of the submit button as below:

If(
    IsBlank(
        LookUp(
            App_Horas,
            Date = Text(
                DatePicker3.SelectedDate,
                DateTimeFormat.ShortDate
            )
        )
    ),
    SubmitForm(Form1),
    Notify(
        "Date repeated, please enter another day!",
        NotificationType.Error
    )
)

Attention: The column name in my Excel table to store the date data is Date. The DatePicker3 represents the DatePicker that users select in the form, please replace it with your own control name and column name.

DateRest.gif

Check if it helps.

Regards,

Qi

 

Best Regards,
Qi

View solution in original post

1 REPLY 1
v-qiaqi-msft
Community Support
Community Support

Hi @Labraham36,

Do you want to check if the selected date has already existed in your data source and avoid this repeated date submitted?

Could you please share a bit more about the scenario:

  1. What is the column type in the Excel table that you used to store the date, a general column?
  2. Make sure that if you want to check the selected date that has existed in your Excel table

From your previous case, I have found that you store all the data in OneDrive and I just assume that you store the date in a general column because this is indeed a suitable method.

In addition, you should not refer to the control name to compare two date which is wrong. You should refer to the real date value to compare with each other. I am not sure what is the DateValue2, which should not be a value in your app, it should be an existing date in your Excel table.

I have a test on my side, please take a try as below.

I store the date in a General column.

Set the OnSelect property of the submit button as below:

If(
    IsBlank(
        LookUp(
            App_Horas,
            Date = Text(
                DatePicker3.SelectedDate,
                DateTimeFormat.ShortDate
            )
        )
    ),
    SubmitForm(Form1),
    Notify(
        "Date repeated, please enter another day!",
        NotificationType.Error
    )
)

Attention: The column name in my Excel table to store the date data is Date. The DatePicker3 represents the DatePicker that users select in the form, please replace it with your own control name and column name.

DateRest.gif

Check if it helps.

Regards,

Qi

 

Best Regards,
Qi

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,047)