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 III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

5 REPLIES 5
RandyHayes
Super User III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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 III
Super User III

@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. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

secondImage

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (12,129)