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

Filtering Out 3rd-tier Dependent Drop Down List Duplicate Values

I have a set of 3 choice fields that are dependent on each other, and connected to SharePoint fields: Area of Focus, SubArea, and Topics. Area of Focus and SubArea are single-select choice fields in PowerApps, connected to single-line text columns in SharePoint, and Topics is a combo-box field in PowerApps connected to a choice column in SharePoint. They each use a look-up list containing the 'Areas' and 'Topics' in question to display filtered options to select from. Here are the formulas I'm currently using to handle the selections:

 

Area of Focus:

Distinct(AreaSubTopicFY20, AreaOfFocus)

- "AreaSubTopicFY20" is a lookup table in SharePoint, containing columns for AreaOfFocus, SubArea, and Topics. 

 

SubArea:

Distinct(Filter(AreaSubTopicFY20, AreaOfFocus = DataCardAOF.Selected.Result),SubArea)

- Distinct here is used because there are repeated SubArea items in the lookup table, due to the variety of items in the Topics column. 

 

Topics:

Filter(Choices(Worksheet.Topics), Value in Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result).Topic)

- Topics is a choice field in SharePoint, containing 447 items. I tried various methods using single-line SharePoint fields, filtering from the lookup table like AreaOfFocus and SubArea's formulas do, but none of them saved data to SharePoint. I followed the instructions here for creating the AreaOfFocus and SubArea dependent drop-downs. 

- SubAreaTopicFY20 is a lookup table similar to AreaSubTopicFY20, but only containing 2 columns for SubArea and Topic, no AreaOfFocus. The SharePoint choice-field containing Topics matches exactly those Topics found in the lookup tables. 

- This method almost works, in that it displays the correct Topics and lets you select many and save them to SharePoint. However, it displays duplicates because certain SubAreas have the same Topics values (like "training" or "records", etc.). I assumed that wrapping this formula in a Distinct() function would remove those duplicates, as seen in the formula for SubArea, but doing so simply removes all available values, leaving nothing to select in the drop-down options.

 

It seems like some small tweak would remove those duplicate Topics, but I haven't figured it out yet. Alternatively if you think I should be handling the 3rd drop down's data-source differently, I'd be happy to try out different methods there.

 

Any assistance is greatly appreciated!

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Filtering Out 3rd-tier Dependent Drop Down List Duplicate Values

Hi @McCarty ,

Could you please share a bit more about your issue?

Do you mean that the Topics ComboBox display duplicates options in your canvas app?

 

If the Topics ComboBox display duplicates options in your canvas app, I think it is impossible. The Choices() function would list all available options you defined under the Topics Choice field in your Worksheet SP List. Unless you defined duplicates options under this Topics Choice field in your Worksheet SP List, otherwise, the Choices(Worksheet.Topics) formula would return distinct options. The Filter(Choices(Worksheet.Topics), Value in Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result).Topic) formula would filter these distinct options matching the specific criteria.

In other words, the list options within your Topics ComboBox is from the Choices(Worksheet.Topics) formula result.

 

Please check if you have defined duplicates options under the Topics Choice field in your Worksheet SP List. If true, please remove the duplicate options from the Topics Choice field in your Worksheet SP List itself.

 

If you still want to apply Distinct function to the Filter result in your Topics ComboBox, please set the Items property of the Topics ComboBox to following:

Distinct(
      Filter(
           Choices(Worksheet.Topics), 
           Value in Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result).Topic
      ),
      Value
)

Set the Update property of the Topics Data card in your Edit form to following (if you are using Edit form to submit your data to SP List, please configure the following setting😞

ForAll(
     TopicsComboBox.SelectedItems,  //TopicsComboBox represents the Topics ComboBox, please replace it with actual ComboBox control name
     {
       Value: Result
     }
)

 

Also, you could also consider set the Items property of the Topics ComboBox to following:

Distinct(
          Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result),
          Topic
)

Set the Update property of the Topics Data card in your Edit form to following (if you are using Edit form to submit your data to SP List, please configure the following setting😞

 

ForAll(
       TopicsComboBox.SelectedItems,
       {
         Value: Result
       }
)

 

 

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.

View solution in original post

2 REPLIES 2
Highlighted
Community Support
Community Support

Re: Filtering Out 3rd-tier Dependent Drop Down List Duplicate Values

Hi @McCarty ,

Could you please share a bit more about your issue?

Do you mean that the Topics ComboBox display duplicates options in your canvas app?

 

If the Topics ComboBox display duplicates options in your canvas app, I think it is impossible. The Choices() function would list all available options you defined under the Topics Choice field in your Worksheet SP List. Unless you defined duplicates options under this Topics Choice field in your Worksheet SP List, otherwise, the Choices(Worksheet.Topics) formula would return distinct options. The Filter(Choices(Worksheet.Topics), Value in Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result).Topic) formula would filter these distinct options matching the specific criteria.

In other words, the list options within your Topics ComboBox is from the Choices(Worksheet.Topics) formula result.

 

Please check if you have defined duplicates options under the Topics Choice field in your Worksheet SP List. If true, please remove the duplicate options from the Topics Choice field in your Worksheet SP List itself.

 

If you still want to apply Distinct function to the Filter result in your Topics ComboBox, please set the Items property of the Topics ComboBox to following:

Distinct(
      Filter(
           Choices(Worksheet.Topics), 
           Value in Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result).Topic
      ),
      Value
)

Set the Update property of the Topics Data card in your Edit form to following (if you are using Edit form to submit your data to SP List, please configure the following setting😞

ForAll(
     TopicsComboBox.SelectedItems,  //TopicsComboBox represents the Topics ComboBox, please replace it with actual ComboBox control name
     {
       Value: Result
     }
)

 

Also, you could also consider set the Items property of the Topics ComboBox to following:

Distinct(
          Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result),
          Topic
)

Set the Update property of the Topics Data card in your Edit form to following (if you are using Edit form to submit your data to SP List, please configure the following setting😞

 

ForAll(
       TopicsComboBox.SelectedItems,
       {
         Value: Result
       }
)

 

 

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.

View solution in original post

Highlighted
Frequent Visitor

Re: Filtering Out 3rd-tier Dependent Drop Down List Duplicate Values

Hi @v-xida-msft thank you for your response and clarifying comments, that got it to work for me. 

 

You are correct: a ComboBox field displayed duplicates in my canvas app. I was using a column title as the formula in Distinct(), and just needed to use "value".

 

To confirm what worked in the situation I described above:

 

'Topics' ComboBox Items property:

 

Distinct(
      Filter(
           Choices(Worksheet.Topics), 
           Value in Filter(SubAreaTopicFY20,SubArea=DataCardSubAOF.Selected.Result).Topic
      ),
      Value
)

 

 

'Topics' Datacard Update property:

ForAll(
       TopicsComboBox.SelectedItems,
       {
         Value: Result
       }
)

 

Thanks again!

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 (6,920)