Reply
Highlighted
Level: Powered On
Posts: 4
Registered: ‎04-10-2017

Data from SQL Datasource to Dropdown Box (Filter and Select column)

If i have a Dropdown with the following items Fx: '[dbo].[tblTestes]'

It list the primary key (Code) in the dopdown.

 

tblTestes has the following columns:

Code

Name

Surname

Phone

 

How can i:

A - list the second column (Name) instead of the (Code) column

B - List the (name) column but filter all the results to a specific (Surname)

 

Thanks

 

PowerApps Staff
Posts: 363
Registered: ‎05-04-2016

Re: Data from SQL Datasource to Dropdown Box (Filter and Select column)

For the first part: open the Advanced view in the right-side pane, and under "Items", you can choose the value that will be displayed in the dropdown. By default it chose the code column, but you can change it to display what you want (in your case, 'Name'), as shown below.

ForumPost001.PNG

 

For the secoond part: you can filter the data source using any column. For this example, I have a text input that the user can type to filter the data based on the surname. In the code below I used the Search function, but you can use the Filter function as well.

If(
    IsBlank(TextInput1.Text),
    '[dbo].[tblTestes]',
    Search('[dbo].[tblTestes]', TextInput1.Text, "Surname"))