cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted

Get multiple values from different column using LookUp

Hi all,

I'm having a little problem getting a collection set up.  I have a sharepoint list that has a few departments and they each have a unique ID.   There is also a manager for each department, and a manager may have more than one department assigned to them.  I'm trying to grab all records with the manager's email, trying extract the department ID for each record, and put it into a collection.  This is what I have so far...

 

Set(var_CurrentUserEmail, Office365Users.MyProfileV2().mail);
ClearCollect(col_CurrentUserDeptIDs, LookUp(Departments, var_CurrentUserEmail in Managers.email, ID));

 

I know I'm missing something.  Please help!

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Get multiple values from different column using LookUp

Hi @lumberjacklurch,

Could you please share a bit more about the Managers column in your SP list?

I suppose that the Managers column that you mentioned is a Person type column in your SP list, is it true?

Based on the formula that you provided, I think there is something wrong with it. The LookUp function could only be used to find the first record in a table that satisfies a formula.

If you want to retrieve the department ID for each one of the extracted records, please take a try with the following workaround:7.JPG

Set the OnSelect property of the "Collect"  button control to following:

Set(var_CurrentUserEmail,User().Email);
ClearCollect(
col_CurrentUserDeptIDs,
Filter('20181119_case13',Manager.Email = var_CurrentUserEmail).ID
)

On your side, you should type following:

Set(var_CurrentUserEmail, Office365Users.MyProfileV2().mail);
ClearCollect(
col_CurrentUserDeptIDs,
Filter('YourSPList',Managers.Email = var_CurrentUserEmail).ID
)

The col_CurrentUserDeptIDs collection as below:
8.JPG

Above formula may cause a Delegation issue, in order to get rid of this issue, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(RecordsCollection, 'YourSPlist')

Set the OnSelect property of the "Collect" button to following:

Set(var_CurrentUserEmail, Office365Users.MyProfileV2().mail);
ClearCollect(
col_CurrentUserDeptIDs,
Filter(RecordsCollection, Managers.Email=var_CurrentUserEmail).ID
)

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
KOM_4410
Level 8

Re: Get multiple values from different column using LookUp

I think you can't use LookUp in your case because that's only going to bring one record.

 

I would use a combination of Filter to select the items you want to select and then add a 'ShowColumns" to bring only the columns you need so your collection doesn't look so messy.

 

It would be something like this:

 

ClearCollect(col_CurrentuserDeptIDs,ShowColumns(Filter(Departments,ManagerEmail=var_CurrentUserEmail),"ColumnName1","ColumnName2","ColumnName3"))

Community Support Team
Community Support Team

Re: Get multiple values from different column using LookUp

Hi @lumberjacklurch,

Could you please share a bit more about the Managers column in your SP list?

I suppose that the Managers column that you mentioned is a Person type column in your SP list, is it true?

Based on the formula that you provided, I think there is something wrong with it. The LookUp function could only be used to find the first record in a table that satisfies a formula.

If you want to retrieve the department ID for each one of the extracted records, please take a try with the following workaround:7.JPG

Set the OnSelect property of the "Collect"  button control to following:

Set(var_CurrentUserEmail,User().Email);
ClearCollect(
col_CurrentUserDeptIDs,
Filter('20181119_case13',Manager.Email = var_CurrentUserEmail).ID
)

On your side, you should type following:

Set(var_CurrentUserEmail, Office365Users.MyProfileV2().mail);
ClearCollect(
col_CurrentUserDeptIDs,
Filter('YourSPList',Managers.Email = var_CurrentUserEmail).ID
)

The col_CurrentUserDeptIDs collection as below:
8.JPG

Above formula may cause a Delegation issue, in order to get rid of this issue, please take a try with the following workaround:

Set the OnVisible property of the first screen of your app to following:

ClearCollect(RecordsCollection, 'YourSPlist')

Set the OnSelect property of the "Collect" button to following:

Set(var_CurrentUserEmail, Office365Users.MyProfileV2().mail);
ClearCollect(
col_CurrentUserDeptIDs,
Filter(RecordsCollection, Managers.Email=var_CurrentUserEmail).ID
)

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (8,861)