cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Dorinda
Super User
Super User

Lookup not working as expected with Display Name

I have a people picker field that returns the display name.

 

I have this code to lookup in another list the employees ID email, department etc.  I know I can get most of this from AD but the employeeID is not available.

 

LookUp(CurrentEmployeeOrg,
    Lower(Email) = Lower(DataCardValue3.Selected.Email),
    EmployeeNumber)

 

This works well in almost every case except when the Users name is Kenneth but the Display is Ken or Judith and display is Judy.

 

I do not know how to make this work based on this scenario.

 

Any help would be appreciated.

4 REPLIES 4
Drrickryp
Super User
Super User

@Dorinda 

That is the problem with using names.  On the other hand, emails are unique and would be a better choice for a lookup. 

I am using emails and it is still not working as expected.

SebS
Memorable Member
Memorable Member

@Dorinda 

 

That's so Random Emails are unique try to Trim emails in the List maybe there is some space in that person email.

 

 

LookUp(CurrentEmployeeOrg,
    Trim(Lower(Email)) = Trim(Lower(DataCardValue3.Selected.Email)),
    EmployeeNumber)

 


If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users to find it.
WarrenBelz
Super User
Super User

@Dorinda ,

What do you mean by except when the Users name is Kenneth but the Display is Ken or Judith and display is Judy.
Are you referring to the email in one place being judy.smith@yourDomain.com and the other place judith.smith@yourDomain.com (in which case, it will never work) or simply the DisplayName which has no bearing on this.  
Assuming DataCardValue3 Items come from AD (or Office365Users), and the Email field (not a good name) in CurrentEmployeeOrg is the same, then (I agree with @SebS ), your code should work. You can also use StartsWith() as it is not case sensitive.

LookUp(
   CurrentEmployeeOrg,
   StartsWith(
      Email,
      DataCardValue3.Selected.Email
   )
).EmployeeNumber

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

MVP (Business Applications)   Visit my blog Practical Power Apps

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (4,574)