cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimSutt1
Frequent Visitor

IsEmpty() Returns FALSE on an LookUp of an Empty Collection??

I am having trouble with the IsEmpty() function when performing a LookUp() on a collection.  I am trying to determine if a user has certain privileges (none, user, etc) based on a collection.  Due to the complexities of the data in the collection, I assume a privilege of "none" and then query the collection for conditions that would establish the user as a "user". 

 

In each case, my code uses the following format:

Set(varUserRole, "None");
ClearCollect(collectUser, Filter(<table name>, EMAIL = <email address>);
If(
  IsEmpty(LookUp(collectUser,<conditions for a user>),
  Set(varUserRole, "None"),
  Set(varUserRole, "User")
);      
      

 

For a user with no special privileges, collectUser would be empty, so the LookUp would not find any records and would also be empty.  However, the IsEmpty() function apparently returns false as varUserRole always comes back as "User".  

2 ACCEPTED SOLUTIONS

Accepted Solutions
Drrickryp
Super User
Super User

@JimSutt1 

Try IsBlank() instead.

View solution in original post

@JimSutt1 

@Drrickryp  is correct, you use IsBlank because when LookUp is blank it returns blank, from the MS docs


Filter and Search return a table that contains the same columns as the original table and the records that match the criteria. LookUp returns only the first record found, after applying a formula to reduce the record to a single value. If no records are found, Filter and Search return an empty table, and LookUp returns blank.

 

 

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

@JimSutt1 

Try IsBlank() instead.

JimSutt1
Frequent Visitor

@Drrickryp , I assume you meant to suggest IsBlank(), which seems to work.  However, that doesn't make sense to me.  It is my understanding that LookUp() returns a record not a value,  IsBlank() looks for a null value, and IsEmpty() looks for a null record.  So how can IsBlank() return true when evaluating a record returned by LookUp()?

@JimSutt1 

@Drrickryp  is correct, you use IsBlank because when LookUp is blank it returns blank, from the MS docs


Filter and Search return a table that contains the same columns as the original table and the records that match the criteria. LookUp returns only the first record found, after applying a formula to reduce the record to a single value. If no records are found, Filter and Search return an empty table, and LookUp returns blank.

 

 

JimSutt1
Frequent Visitor

Thank you @EddieE and @Drrickryp !!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (2,836)