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

Fetching the corresponding values from another list

Hi PowerApps users,

Please help me with the below scenario-

I have a Master list with a Muti selectable Choice field called Departments. There is another list- Child list with the same value of departments stored as text field and a corresponding Head of Department (HOD)- Persons field (multi valued).

Master List-

Departments [Mutiselectable Choice fields]

Child List-

Departments [Single line text fields]

HOD [Muti valued Person field]

When a department (s) is selected, the user should be displayed with the display names of the HODs to whom the mail will be triggered.

Can anyone direct me on how i can fetch the corresponding HOD details from the Child list.

Any help appreciated.

Thanks,

Kevin

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Resolver I
Resolver I

Re: Fetching the corresponding values from another list

Hi @panand99 ,

Apologies, I'm just a beginner.
I almost got the result. But the EmailCollection has the Person field as a whole. How do i get the Email property only from it.

Clear(Collection1);Clear(EmailCollection);ForAll(DataCardValue2_Departments.SelectedItems,Collect(Collection1,Value));ForAll(Collection1,Collect(EmailCollection,Filter(ChildList,Title=Value).HOD));


I tried adding another collection to filter out only the email, but that doesnt work.
ForAll(EmailCollection,Collect(EmailCol,HOD.Email))



Hi @QJappie22 ,

Your suggestion was the simplest of all and it kind of works although with the delegation warning. Need to see how i can fix the delegation warning.

 

 

Hi @v-xida-msft ,

It took me sometime to figure out the solution you provided. It works, but with the delegation warning. I don't want to entirely use this solution as i found a simpler way.

Any suggestion on how i can fix the delegation warning?

 

Appreciate the help guys.

This is the solution i could come up with the suggestions you guys provided.

On the OnChange property of the Master list Department field-

 

Clear(Collection1);Clear(EmailCollection);

ForAll(DataCardValue_DeptChoice.SelectedItems,Collect(Collection1,Value));ForAll(Collection1,Collect(EmailCollection, LookUp(Childlist,Department_Lookup exactin Value,HOD.Email)))

Now i assigned the EmailCollection to the Items property of my Dropdown.

 

Regards,

Kevin

View solution in original post

5 REPLIES 5
Highlighted
Resolver I
Resolver I

Re: Fetching the corresponding values from another list

Just an update,

if the choice field in the Master list is not multichoice (single valued), then this would work-

LookUp('ChildList',Title=DataCardValue2_Departments.Selected.Value,HOD.Email)

How can i get this working for a multichoice field. I tried using ForAll, not able to get the correct expression to use.

Regards,

Kevin

Highlighted
Skilled Sharer
Skilled Sharer

Re: Fetching the corresponding values from another list

@kevingeorget 

 

on the multiple selection combo box OnChange event you need to create a collection and then iterate this collection to some other collection. below is the formula you can use:- 

 

 

Clear(Collection1);
Clear(EmailCollection);
ForAll(cb_SubTeams.SelectedItems,Collect(Collection1,Result));
ForAll(Collection1,Collect(EmailCollection,Filter(AllTeamMembers,TeamName.Value=Value).MemberEmail))

 

You can use Filter or lookup based on your need.

This formula is working at my end, please change the values accordingly.

 

 

 

Highlighted
Resolver II
Resolver II

Re: Fetching the corresponding values from another list

Hi @kevingeorget,

Instead of using '=' is it not possible in this situation to use 'exactin'? Then it checks if the value is in one of the values of the multichoice.
LookUp('ChildList',Title exactin DataCardValue2_Departments.Selected.Value,HOD.Email)

Hope this helps!

Highlighted
Community Support
Community Support

Re: Fetching the corresponding values from another list

Hi @kevingeorget ,

I have made a test on my side, please consider take a try with the following workaround:5.JPG

 

6.JPG

Set the Items proeprty of the Dropdown box to following:

 

Distinct(
     Filter(
       Split(
         Concat(
                 ForAll(
                        ForAll(Filter('20190108_School', School in ComboBox1.SelectedItems.Value).Executor, Executor.Email),
                        Concat(Value, Email & ";")
                ),
                Value
         ),
         ";"
     ),
     !IsBlank(Result)
   ),
   Result
)

Note: The Executor is a Person type column in my School List, which has enabled "Allow Multiple Selections" option.

 

On your side, if you want to get the corresponding HOD email table based on the selected departments value, please take a try with the following formula:

 

 

Distinct(
     Filter(
       Split(
         Concat(
                 ForAll(
                        ForAll(Filter('ChildList', Title in DataCardValue2_Departments.SelectedItems.Value).HOD, HOD.Email),
                        Concat(Value, Email & ";")
                ),
                Value
         ),
         ";"
     ),
     !IsBlank(Result)
   ),
   Result
)

Please consider take a try with above solution, then check if the issue is solved.

 

More details about ForAll function, Concat function and Split function, please check the following article:

ForAll function, Concat function and Split function

 

Best regards,

 

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.
Highlighted
Resolver I
Resolver I

Re: Fetching the corresponding values from another list

Hi @panand99 ,

Apologies, I'm just a beginner.
I almost got the result. But the EmailCollection has the Person field as a whole. How do i get the Email property only from it.

Clear(Collection1);Clear(EmailCollection);ForAll(DataCardValue2_Departments.SelectedItems,Collect(Collection1,Value));ForAll(Collection1,Collect(EmailCollection,Filter(ChildList,Title=Value).HOD));


I tried adding another collection to filter out only the email, but that doesnt work.
ForAll(EmailCollection,Collect(EmailCol,HOD.Email))



Hi @QJappie22 ,

Your suggestion was the simplest of all and it kind of works although with the delegation warning. Need to see how i can fix the delegation warning.

 

 

Hi @v-xida-msft ,

It took me sometime to figure out the solution you provided. It works, but with the delegation warning. I don't want to entirely use this solution as i found a simpler way.

Any suggestion on how i can fix the delegation warning?

 

Appreciate the help guys.

This is the solution i could come up with the suggestions you guys provided.

On the OnChange property of the Master list Department field-

 

Clear(Collection1);Clear(EmailCollection);

ForAll(DataCardValue_DeptChoice.SelectedItems,Collect(Collection1,Value));ForAll(Collection1,Collect(EmailCollection, LookUp(Childlist,Department_Lookup exactin Value,HOD.Email)))

Now i assigned the EmailCollection to the Items property of my Dropdown.

 

Regards,

Kevin

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,627)