cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
TesDA
Level: Powered On

Show Error if Dates dont follow proper logic

I'm just not sure where to start on this since I'm a newbie in powerapps.

 

I have two dates that the user is prompted to enter: DateCardStart, DateCardEnd

How do I require that DateCardEnd is always >= DateCardStart?

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Show Error if Dates dont follow proper logic

One easy way is to unlock one of your Date dataCards in your Edit form and then modify the ErrorMessage control.

In that control, first, change the text to the error you want to display.

Then, change the Visible property and put in your logic there.

Something like:

   (DataCardValue13.SelectedDate>=DataCardValue15.SelectedDate)

 

This will return a true or false depending on the values and thus govern if the Error Message is displayed.

You can also tie this to your Submit button to disable it (DisplayMode) unless the information is valid.

 

Keep in mind that DataCards in a form all contain at least 4 controls:

   StarVisible - This is the "required" field indicator

   ErrorMessage - This is the label that has error text in it.

   DataCardVale - a control (based on the underlying data type) where the value is displayed, edited or otherwise used.

   DatCardKey- The label that shows the name of the field.

 

You can always unlock and work with them on your own, or create your own.

 

Hope this helps some.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: Show Error if Dates dont follow proper logic

One easy way is to unlock one of your Date dataCards in your Edit form and then modify the ErrorMessage control.

In that control, first, change the text to the error you want to display.

Then, change the Visible property and put in your logic there.

Something like:

   (DataCardValue13.SelectedDate>=DataCardValue15.SelectedDate)

 

This will return a true or false depending on the values and thus govern if the Error Message is displayed.

You can also tie this to your Submit button to disable it (DisplayMode) unless the information is valid.

 

Keep in mind that DataCards in a form all contain at least 4 controls:

   StarVisible - This is the "required" field indicator

   ErrorMessage - This is the label that has error text in it.

   DataCardVale - a control (based on the underlying data type) where the value is displayed, edited or otherwise used.

   DatCardKey- The label that shows the name of the field.

 

You can always unlock and work with them on your own, or create your own.

 

Hope this helps some.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

Super User
Super User

Re: Show Error if Dates dont follow proper logic

What I would do for this is create a label that says that says lets them know "End date must be equal to or greater than Start Date" or something to that effect.

 

For the OnVisible of the Label put =If(DateEnd.SelectedDate>=DateStart.SelectedDate,false, true)

 

 

Then wherever the click to submit the form make it disabled if that label is visible.

 

You could use the same concept but make a fill color or text color or something else but I find labels to be best bet for users.

 

 

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (4,698)