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)
I did not found better solution.
What I am doing now is doing two step process.
1. First I create the lookup (as you did, but in my case I pull all columns):
ClearCollect(
colPeopleMaster,
AddColumns(
colPeople,
"personLookup", LookUp('People Details', GPN = colPeople[@sap_coo_gpn])
))
2. I pick columns that I am interested (as example I put two, but in my case there are 8 of them):
ClearCollect(
colPeopleMasterManagement,
AddColumns(
colPeopleMaster,
"name", personLookup.name,
"email", personLookup.email
))
Hope that helps,
Kornel
Hi @Kornel. Did you find a solution for this? I am running into the same problem.
I found that you can retrieve the data with one LookUp using the following code, however it means you need to refer to it everytime as SearchData.name, instead of just having a column named "name".
ClearCollect(
colPeopleMaster,
AddColumns(
colPeople,
"SearchData",
LookUp('People Details', GPN = colPeople[@sap_coo_gpn],
{
name: Name,
email: Email
}
)
)
)
Please let me know if there is a cleaner approach!
So more like using join in SQL than vlookup in Excel.
Join two tables with a key.
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
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.
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!
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!
Is Employees the foreign (looked up) list?
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
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2