web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to return multiple...
Power Apps
Unanswered

How to return multiple columns from a LookUp functin?

(0) ShareShare
ReportReport
Posted on by 377

Hello All,

 

I need to do a LookUp on a table and return a concatenated return value o two columns.  Can you please let me know how to do it?

 

I tried this and its giving me an error. Here clSearchResults is another collection that has the ID column. That part is not an issue but returning multiple fields in a concatenated form is giving me an error. Thanks 

 

LookUp (Employees,

ID = colSearchResults[@ID].ID,

FirstName & LastName)

 

 

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @rprahalad 

    I am not entirely sure where a collection fits into this, but your formula will not work as you are trying to do equality operation on the ID and a table of ID's.  

     

    So are you trying to get all of the concatenated names based on a collection, or just how does this collection fit into your needs?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @rprahalad 

    You need to concatenate the results of two lookup columns.  I don't think you can do it within a single lookup.

     

    LookUp(Employees,ID = colSearchResults[@ID].ID,FirstName) &" "& 
    LookUp(Employees,ID = colSearchResults[@ID].ID,LastName)

     

  • rprahalad Profile Picture
    377 on at

    Thanks for your response. Its actually a LookUp column. So, technically  I am just doing Select * from Employees where ID= 5. But I just need to do Select FirstName + " " + LastName from Employees where ID=5

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @rprahalad 

    Is Employees the foreign (looked up) list?

  • rprahalad Profile Picture
    377 on at

    That's what I feared. Making two calls to DataVerse just to get  data from two columns  is what I am trying to avoid. Thanks for your response though!

  • Verified answer
    rprahalad Profile Picture
    377 on at

    Yep! Sorry I should have mentioned this. This code is actually part of AddColumns block. It is one-one and I am just querying the Employees table with an absolute scalar ID and i need to return just a concatenated name. Thanks again!

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @rprahalad 

    You don't need to make two calls to the datasource.  In fact, that is not how it works at all in PowerApps.  When you lookup against a datasource, there is one call made to your cloud session table.  After that, the app has the value for the future.

     

        LookUp(Employees, ID = 5, FirstName & "  " & LastName)

    Will return the First and last names combined together for the Employees record with an ID of 5 in this example.

     

    So, your original formula is fine.  Your problem is that you are trying to lookup on an ID and a Table of ID's, that will not work.

  • rprahalad Profile Picture
    377 on at

    Thanks @RandyHayes ! That was it. 

  • Kornel Profile Picture
    56 on at

    Hi all,

    I am thinking about similar situation, but I need separate columns.

    Right now the code looks like:

    ClearCollect(
     colPeopleMaster,
     AddColumns(
     colPeople,
     "name", LookUp('People Details', GPN = colPeople[@sap_coo_gpn], Name),
     "email", LookUp('People Details', GPN = colPeople[@sap_coo_gpn], Email)
    ))

    I have some collections where I need to pull 5-7 different columns, is there a way to do it in one LookUp?

    Thanks!

    Kornel 

  • Kornel Profile Picture
    56 on at

    So more like using join in SQL than vlookup in Excel.

    Join two tables with a key.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard