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

Filtering Choices Based on Text

Hi All,

 

I have a simple set of ComboBoxes drawing data from a sharepoint list. They are both choice fields in sharepoint. The first is a list of production lines, ex: "Line 1", "Line 2", "Line 3". The second is production stations, ex, "Station 1, Line 1", "Station 2, Line 2", "Station 3, Line 4". 

 

What I would like to do is filter the second ComboBox to only show entries that contain the line number from the first box. I have researched cascading Dropdowns, but in this case I need to use ComboBoxes. My questions:

 

1) Is there a function I could use to do something along the lines of this: Filter(Choices([@'Process Audits'].Station), Contains(Station, LineCombobox.selected)) This would only display the station choices that have the line number that was previously selected.

 

2) Once I have filtered them, is there a way to change what is displayed on the app so that the user doesn't need to see the ,Line# section. 

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
v-siky-msft
Community Support
Community Support

Hi @CurtS ,

 

Your requirements are not easy to implement based on two choices column in PowerApps, however, here is alternative workaround that use a reference list to accomplish your needs. Please check this:

1, create a new list to store the choice option values, add an extra column 'Title' to store station without line# section.

Snipaste_2020-06-08_14-46-07.png

2, set the items property of StationCombobox as follows, 

Filter('New List',Line=LineComboBox.Selected.Value)

3, set Primary Field to Title, to resolve your second question.

4. If you want to save the selection to sharepoint list, the patch function should be like this:

Patch('Process Audits', Defaults('Process Audits'),{Station: {Value: StationCombobox.Selected.Station}})

The same for EditForm, you need to modify the Update property of Station Data Card to {Value: StationCombobox.Selected.Station}.

Hope this helps.

Sik

View solution in original post

2 REPLIES 2
WarrenBelz
Super User III
Super User III

Hi @CurtS ,

I am assuming that all Production Lines do not have the same Station Numbers and that you only want to show Station Numbers that belong to the line selected? I do not know a way of filtering choice fields and some testing only produced errors.

Assuming that you have this data on the same line of your list - you might try this.

Distinct(
    Filter(
        YourSPListName,
        ProductionLine=YourProdLineComboBox.Selected.Value
    ),
    StationNo       //or whatever you called the field
).Result

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

v-siky-msft
Community Support
Community Support

Hi @CurtS ,

 

Your requirements are not easy to implement based on two choices column in PowerApps, however, here is alternative workaround that use a reference list to accomplish your needs. Please check this:

1, create a new list to store the choice option values, add an extra column 'Title' to store station without line# section.

Snipaste_2020-06-08_14-46-07.png

2, set the items property of StationCombobox as follows, 

Filter('New List',Line=LineComboBox.Selected.Value)

3, set Primary Field to Title, to resolve your second question.

4. If you want to save the selection to sharepoint list, the patch function should be like this:

Patch('Process Audits', Defaults('Process Audits'),{Station: {Value: StationCombobox.Selected.Station}})

The same for EditForm, you need to modify the Update property of Station Data Card to {Value: StationCombobox.Selected.Station}.

Hope this helps.

Sik

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,655)