cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TesDA Helper IV
Helper IV

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Top Solution Authors
Top Kudoed Authors
Users online (7,820)