cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
codebrane
Resolver I
Resolver I

ifEmpty and else

In one screen I have a gallery with the next button set to:

 

Navigate(Screen1,Fade, {usr: Subtitle2.Text})

 

and in Screen1 I have in Item:

 

If(!IsEmpty(usr), LookUp(Students, Title = usr))

 

and it loads the information on the user from the DataSource. I've added a + button to the gallery screen that does:

 

Navigate(Screen1,Fade, {usr: ""})

 

and changed Screen1 Item to:

 

If(!IsEmpty(usr), LookUp(Students, Title = usr), Defaults(Students))

 

but when usr is "" I get "no item to display" in Screen1. If I use Item: Defaults(Students) it works and displays empty fields that let me add a new record.

 

Is there a way to use isEmpty and else? i.e. if usr is not empty show the record, else use Item: Defaults(Students)

2 ACCEPTED SOLUTIONS

Accepted Solutions
codebrane
Resolver I
Resolver I

turned out I needed to use isBlank instead of isEmpty. Curious why "" == isEmpty = false

View solution in original post

Hi @codebrane

 

The reason for this behavior is because the IsEmpty function is designed to test for empty tables.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-isblank-isempty

 

In this instance, IsBlank is the correct function because you're testing that the field value "usr" is blank.

View solution in original post

2 REPLIES 2
codebrane
Resolver I
Resolver I

turned out I needed to use isBlank instead of isEmpty. Curious why "" == isEmpty = false

View solution in original post

Hi @codebrane

 

The reason for this behavior is because the IsEmpty function is designed to test for empty tables.

 

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-isblank-isempty

 

In this instance, IsBlank is the correct function because you're testing that the field value "usr" is blank.

View solution in original post

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

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (36,667)