cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
golfnutt8
Helper I
Helper I

Validation formula IsEmpty not working

Hello, I am attempting to create a formula that validates if the fields on the form are not empty.
If any are empty then show a failure screen and if they are not empty then show a success screen.

The below is not working for me. What is the issue?

If(IsEmpty(DataCardValue1)Or(IsEmpty(DataCardValue2)Or(IsEmpty(DataCardValue3)Or(IsEmpty(DataCardValue4)Or(IsEmpty(DataCardValue8),Navigate(FailScreen,ScreenTransition.Fade),Navigate(FolderCreatedSuccessScreen,ScreenTransition.Fade)

Thank you for your help!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@golfnutt8 

The easiest way to do this is through the build in Valid property of the EditForm rather than building it yourself.

If you set the fields represented by DataCardValue1, 2, 3, 4, and 8 in the EditForm to "required", then you can use the following formula.

 

If(yourFormName.Valid, 
    Navigate(FolderCreatedSuccessScreen,ScreenTransition.Fade),
    Navigate(FailScreen,ScreenTransition.Fade)
)

 

In general, it is not good to reference the DataCardValue controls in the EditForm, but instead reference the DataCard Update property - this is where the "real" value that will be written to the datasource will exist.

 

I hope this is helpful for you.

_____________________________________________________________________________________
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!

View solution in original post

5 REPLIES 5
RandyHayes
Super User
Super User

@golfnutt8 

The easiest way to do this is through the build in Valid property of the EditForm rather than building it yourself.

If you set the fields represented by DataCardValue1, 2, 3, 4, and 8 in the EditForm to "required", then you can use the following formula.

 

If(yourFormName.Valid, 
    Navigate(FolderCreatedSuccessScreen,ScreenTransition.Fade),
    Navigate(FailScreen,ScreenTransition.Fade)
)

 

In general, it is not good to reference the DataCardValue controls in the EditForm, but instead reference the DataCard Update property - this is where the "real" value that will be written to the datasource will exist.

 

I hope this is helpful for you.

_____________________________________________________________________________________
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!

View solution in original post

flugaoveltem
Resolver III
Resolver III

Hi @golfnutt8 

It depends on what type of a datacard you are evaluate from.

Usually is going to take DataCardValue1.Selected.Value if a dropdown or DataCardValue1.Text if is a text input.

The issue is that I have five fields on a form and I want to make sure all fields (datacardvalues) are not empty.
If using the DataCardValue's are not correct for validation then what is? 

golfnutt8
Helper I
Helper I

Thanks for clarifying that there are differences between dropdown fields and text fields.
I will modify my formula and see if that helps.

RandyHayes
Super User
Super User

@golfnutt8 

As mentioned in my reply, this capability is all built into the form already - you really don't need to write this type of validation for Empty fields.  You might want to give that a shot first.

_____________________________________________________________________________________
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!

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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Users online (1,610)