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

Variables in Lookup Functions

I am building a canvas app and would like for a label to display a user's designated access level based on a lookup function to a table and their current email address. I have a variable (CurrentUser) set up to capture the user's email address when the app loads, as this value is used in multiple other places throughout the app. My formula in the label's Text property is set up as follows:

 

Lookup(Table2, CurrentUser = EmailAddressColumn, AccessLevel)

 

The problem is that the formula keeps returning a blank value, even though I have confirmed that Table2 does contain the email values I need. Am I missing something?

4 REPLIES 4
CNT
Super User
Super User

@ahessel Try reversing the formula like this,

Lookup(Table2, EmailAddressColumn=CurrentUser, AccessLevel)

BCLS776
Super User
Super User

There are a couple of ways your LookUp() can go sideways:

  1. Your expression: CurrentUser = EmailAddressColumn isn't returning true for any record. Carefully check to make sure your CurrentUser variable is getting assigned a value that makes sense and that the EmailAddressColumn is of the correct type and format to work with your expression.
  2. Make sure the AccessLevel column in your table is populated with values. The LookUp() is returning whatever is in that field, blank or not.

Hope that helps,

Bryan

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
ahessel
Frequent Visitor

Thanks, but when I gave this a try, it's still returning blanks!

RandyHayes
Super User
Super User

@ahessel 

Be cautious with letter case of the email address.  The User() function (if that is what you are using) can sometimes return an email address with a different case than you expect.  

 

Change your formula to the following to overcome that:

   Lookup(Table2, StartsWith(EmailAddressColumn, CurrentUser) , AccessLevel)

 

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.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
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
Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

<
Users online (2,419)