cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
codebrane
Level 8

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
Level 8

Re: ifEmpty and else

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

View solution in original post

Highlighted
Super User
Super User

Re: ifEmpty and else

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
Level 8

Re: ifEmpty and else

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

View solution in original post

Highlighted
Super User
Super User

Re: ifEmpty and else

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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,998)