cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
kevingeorget
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

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
kevingeorget
Resolver I
Resolver I

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

panand99
Impactful Individual
Impactful Individual

@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.

 

 

 

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!

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.

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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