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

Different Error messages should be displayed for a single label based on conditions of DatePicker Control

Hi,

I have a two Datepicker control(startdate and EndDate) and there is a Label ErrorMessage3 and LabelErrorMessage4 in two different DataCards.

 

2019_02_05_20_10_49_Expense_Report1_Saved_Unpublished_PowerApps.png

 

 

 

 

 

I need to validate Datepicker Control with two Conditions and with different error messages need to display by default visible is false for ErrorMessage3.

1)StartDate Datepicker control should not be greater that EndDate Datepicker control

 Ex: ErrorMessage3: StartDate should not be greater than EndDate

2)For Startdate and EndDate should not select future dates

 Ex:ErrorMessage3: Future dates should not be selected

 

My question is how to display error message based on condtion and how to Make ErrorMessageVisible true.I have tried creating a context variable I have written code in below Text property of ErrorMessage3textpropPowerApps.png

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Different Error messages should be displayed for a single label based on conditions of DatePicker Control

You've got some general syntax errors in your formula.  Check your paren's and notice that you are missing some.

That's first.

Second - you can't use a statement like UpdateContext in the property like that.  That's a behavior statement.

 

Now...

What you want to look at is both the text property and the visible property of the ErrorMessage3 label.

What your label says is what is in the Text property -

    If(DataCardValue3.SelectedDate>Today(), "Future Dates cannot be selected", DataCardValue3.SelectedDate>DataCardValue4.SelectedDate, "Not greater than End Date")

When you see the label is based on the Visible property -

   (DataCardValue3.SelectedDate > Today() || DataCardValue3.SelectedDate > DataCardValue4.SelectedDate)

 

Hope that helps.

 

_____________________________________________________________________________________
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: Different Error messages should be displayed for a single label based on conditions of DatePicker Control

You've got some general syntax errors in your formula.  Check your paren's and notice that you are missing some.

That's first.

Second - you can't use a statement like UpdateContext in the property like that.  That's a behavior statement.

 

Now...

What you want to look at is both the text property and the visible property of the ErrorMessage3 label.

What your label says is what is in the Text property -

    If(DataCardValue3.SelectedDate>Today(), "Future Dates cannot be selected", DataCardValue3.SelectedDate>DataCardValue4.SelectedDate, "Not greater than End Date")

When you see the label is based on the Visible property -

   (DataCardValue3.SelectedDate > Today() || DataCardValue3.SelectedDate > DataCardValue4.SelectedDate)

 

Hope that helps.

 

_____________________________________________________________________________________
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

nagamanikanta
Level: Powered On

Re: Different Error messages should be displayed for a single label based on conditions of DatePicker Control

Thanks for the reply!

It's working fine.

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 (5,132)