Convert A Single Line Of Text Field Values To DropDown And Filter A Gallery

Overview

 
For useful scenarios to help build Power Apps refer to my blog,
Let’s say you have a table of records where you have most of your columns as a single line of text. Now, while developing the application you come across filtering this table of records with these single line of text values which are unique in their own way. 
 
For example, the below-listed columns are a single line of text in a SharePoint list,
  • Column1 - City
  • Column2 - Country
  • Column3 - Continent
And you have records as below,
 
Convert A Single Line Of Text Field Values To DropDown And Filter A Gallery
 
In Power Apps, let’s add a gallery control and connect its data source to the above SharePoint list and add a dropdown control with the following formula as shown below,
 
Convert A Single Line Of Text Field Values To DropDown And Filter A Gallery
 
For Country ComboBox - Items property add,
  1. Distinct(SharePointList,Country).Result  
Set SelectMultiple to false.
 
For Gallery control - Items property add,
  1. SortByColumns(      
  2.     Filter(      
  3.         SharePointList,      
  4.         (IsBlank(ComboBox.Selected.Result) || (IsEmpty(ComboBox.Selected.Result) || (Country = ComboBox.Selected.Result)))      
  5.     ),      
  6.     “ID”,      
  7.     Ascending      
  8. )       

Output

Convert A Single Line Of Text Field Values To DropDown And Filter A Gallery