cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
r2d2beep
Frequent Visitor

Cascading dropdowns from Choices column

Hi everyone,

 

Looked all around the forums, Google, Youtube but no luck with what seems like a simple problem. I'm trying to create a cascading dropdown to select the value for a Choices column in Sharepoint. The parent column is a Single Line of Text column containing the names of all employees. The dependent column is a Choice column containing the names of their managers. I would like to have the default value of the manager from the Choice column appear when the user selects the employee. 

 

The solution suggested in the link below is the closest to what I am trying to achieve but I get the error message stating "Incompatible types for comparison. These types can't be compared: Error, Error.".

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Cascading-dropdown-with-SharePoint-Choice-co...

 

The code I used was:

 

 

Filter(Choices(MT_Tracker_Sharepoint.Manager), Value in Filter(AddColumns(MT_Tracker_Sharepoint,"T3", Manager.Value), Employee.Value=ComboBox3.Selected.Value).T3)

 

 

The code works if both the parent and child columns are Choice columns in Sharepoint, but it doesn't seem to work if one of them is a Text column. Any ideas on how to resolve this would be appreciated. Thank you.

1 ACCEPTED SOLUTION

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi @r2d2beep,

Based on the issue that you mentioned, do you want to populate the Managers Combo Box based on the employees Combo Box selected?

Could you please tell me that how you set the Items property of the employees Combo Box?

Actually, there is no need to refer to the answer from the thread you mentioned because the data type if completely different.

1). I recommend that you could use the Distinct() function to set the employees Combo Box Items property as below:

Distinct(MT_Tracker_Sharepoint,Employee)

2). Set the Items property of the Managers Combo Box as below:

Choices(MT_Tracker_Sharepoint.Manager)

Set the DefaultSelectedItems property of the Managers Combo Box as below:

ForAll(
    Filter(
        MT_Tracker_Sharepoint,
        Employee = ComboBox12.Selected.Result
    ).Manager,
    Manager
)

 

vqiaqimsft_0-1628564051528.png

vqiaqimsft_1-1628564067769.png

 

Best Regards,
Qi

View solution in original post

4 REPLIES 4
PG_WorXz10
Resident Rockstar
Resident Rockstar

Hi @r2d2beep ,

 

I assume your comboBox is the choice field. If so could you please share the items property also ?

If this post was helpful or you need more help please consider giving Thumbs Up and Tag me in your reply I'll be happy to help. If this post helped you solve your issue please click Accept as solution and provide Thumbs Up. This will help others find it more readily.

v-qiaqi-msft
Community Support
Community Support

Hi @r2d2beep,

Based on the issue that you mentioned, do you want to populate the Managers Combo Box based on the employees Combo Box selected?

Could you please tell me that how you set the Items property of the employees Combo Box?

Actually, there is no need to refer to the answer from the thread you mentioned because the data type if completely different.

1). I recommend that you could use the Distinct() function to set the employees Combo Box Items property as below:

Distinct(MT_Tracker_Sharepoint,Employee)

2). Set the Items property of the Managers Combo Box as below:

Choices(MT_Tracker_Sharepoint.Manager)

Set the DefaultSelectedItems property of the Managers Combo Box as below:

ForAll(
    Filter(
        MT_Tracker_Sharepoint,
        Employee = ComboBox12.Selected.Result
    ).Manager,
    Manager
)

 

vqiaqimsft_0-1628564051528.png

vqiaqimsft_1-1628564067769.png

 

Best Regards,
Qi

View solution in original post

Hi Qi, thank you so much, this works perfectly. I didn't know about the ForAll function until now, will definitely keep it in mind for the future. Thanks again!

Hi @PG_WorXz10, the other answer solved the issue, but thank you for your response.

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,586)