cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
GauravG
Continued Contributor
Continued Contributor

Need help with Error Message

In the field shown below- since it is a link field, i want to show an error if it does not contain two backslashes "//"

And it is working fine with this formula 
If((IsBlank(Find("//",DataCardValue2.Text))),"An entry is required or has an invalid value.")

GauravG_0-1610145980994.png

The value entered here does not have 2 backslashes and so it shows an error.

 

The problem is that even when somebody is filling out the form, it shows out the error by default. I want it to behave like other fields which show error only if a mandatory field is blank upon submission not. Other fields have this error message- 
If(Not(IsBlank(Parent.Error)),"An entry is required or has an invalid value.")

1 ACCEPTED SOLUTION

Accepted Solutions
GauravG
Continued Contributor
Continued Contributor

@Drrickryp @RandyHayes Thank you so much both.

Your direction helped me achieve it- a lil differently though. I took these actions

Error Message, Text Property = If(Or(Not(IsBlank(Parent.Error)),!IsMatch(DataCardValue45.Text,"//",Contains)),"An entry is required or has an invalid value.") 

Then, on Visible property of error message- i define a global variable named "gLinkError"

 

The variable turns true when the OnSAVE property of SP Integration form is saved without any value or without "//"- using Set(gLinkError,true)

OnNEW Property of SP Integration form is set to Set(gLinkError,false)

 

Thanks both again!

View solution in original post

12 REPLIES 12
RandyHayes
Super User III
Super User III

@GauravG 

Set the Required property of the datacard to the following:

   "//" in DataCardValue2.Text

Set the text of your error label to:

   "An entry is required or has an invalid value."

Set the Visible property of the label to:

    !IsBlank(Parent.Error)

 

Should give you what you need.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
GauravG
Continued Contributor
Continued Contributor

@RandyHayes I am a tricky issue- the field's required values is dependent on the field just above it.

If i separate them by a colon- it shows an error, and can't even use AND operator between both the logics

GauravG_0-1610148351259.png

Please advise, based on the screenshot!

RandyHayes
Super User III
Super User III

@GauravG 

Change your formula to the following:

("//" in DataCardValue2.Text) && DataCardValue40.Value

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
GauravG
Continued Contributor
Continued Contributor

@RandyHayes Please refer the screenshot below

The field "BRD Supplement Link" should show mandatory/ required asterisk (*) if the field just above it titled "New Report/ Version" is turned "ON"- which it is by default. 

With this ("//" in DataCardValue45.Text) && DataCardValue40.Value- the required asterisk appears only when both // and the field above is ON. That's not the case.

The intention is to first make the field "BRD Supplement Link" mandatory based on the field above being "ON" and then show the error if the value in BRD Supplement is either blank or not containing // (meaning link)

Am sorry for bothering again- thanks for continually helping!

 

GauravG_0-1610149066898.png

 

RandyHayes
Super User III
Super User III

@GauravG 

Set the visible property of the asterisk label to:

   DataCardValue40.Value 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
GauravG
Continued Contributor
Continued Contributor

@RandyHayes Thanks, asterisk is working fine. However, when i tried saving the BRD Supplement field with blank- it did not show an error on the field. This field being a link should always contain "//". And i expected an error if it does not have it! 

GauravG_0-1610150686977.png

 

GauravG
Continued Contributor
Continued Contributor

@RandyHayes I guess this is because we artificially induced the asterisk. The error pops up for mandatory fields. And the value key doesn't consider it to be mandatory just yet.

RandyHayes
Super User III
Super User III

@GauravG 

Ah, so one other bit to add...

In the Update property of the datacard, put the following formula:

   If(DataCardValue40.Value && !("//" in DataCardValue2.Text), Blank(), DataCardValue2.Text)

This will force the Update to see its value as blank if it is not valid and thus force it to be an error (based on the Required property)

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
GauravG
Continued Contributor
Continued Contributor

@RandyHayes Unfortunately, this did not work. I'll summarize- what all i have done. Please note however, that "BRD Supplement Link" data card is DataCardValue45 and not DataCardValue2--- 2 in my original question was just mentioned as an example.

Changes made are:-

BRD Supplement Link DataCard, Update Property = If(DataCardValue40.Value && !("//" in DataCardValue45.Text), Blank(), DataCardValue45.Text) 

BRD Supplement Link DataCard, Required Property = ("//" in DataCardValue45.Text) && DataCardValue40.Value

StarVisible, Visible Property = DataCardValue40.Value

Error Message, Text Property = "An entry is required or has an invalid value."

Error Message, Visible Property = !IsBlank(Parent.Error)

GauravG_0-1610158016787.png

 

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 (1,182)