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

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
Highlighted
Community Support
Community Support

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
Highlighted
Resolver II
Resolver II

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"))

Highlighted
Community Support
Community Support

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
Community Conference

Power Platform Community Conference

Come join us today! Find your favorite faces from the community presenting at the Power Platform Community Conference!

Watch Now

Experience what’s next for Power Apps

See the latest Power Apps innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (2,808)