PowerApps Drop Down Multiple Source

PowerApps Drop Down: Show Values from multiple Data Sources

Premise

In this post we’ll discuss how to conditionally, display values from multiple columns/sources inside a single drop down/combo box control in Microsoft PowerApps.

Solution

We all know that how easily we can bind data to a drop down control in PowerApps. Basically, we just need to point the right column of the data source to the drop down control and, all the values gets loaded automatically.

In this case, however, we’ll be populating the drop down control from a SharePoint master list. This list contains 2 columns, SiteName and FriendlyName.

The requirement is that, to show the values from the column, FriendlyName, only if it is not empty. Otherwise, show values from the column SiteName.

PowerApps: Master SharePoint List

For ex, based on the above picture, my drop down control should display the following,

  • Home
  • Site2
  • About Us

Directly, we cannot bind a single drop down to multiple columns. However, we can create a new column in our PowerApps collection, and then bind the control to this new column.

PowerApps: Drop Down MultipleSource

To do that, we can simply write the following code to the Items property of our drop down or combo box control.

AddColumns(MultipleDataSourceDropdown, "HybridColumn",If(IsBlank(FreindlyName) || IsEmpty(FreindlyName), Title, FreindlyName))
PowerApps Drop Down: Multiple Data Sources

Be sure to set the Value property of your control to this newly created column.

Run the app. The drop down or, combo box will load items from both the sources, conditionally. Similarly, sometimes we might need to append the values of 2 or more columns to display inside the drop down. It can also be achieved using the same approach.

PowerApps Drop down conditional values

Formula Breakup

We’re passing the following values to the function, AddColumns.

ValuesDescription
MultipleDataSourceDropdownSource List. This is our data source.
HybridColumnThe name of our new column. We can use any value here.
[Formula]This formula will be used to populate the value of the newly created column against each row of the given collection.

Cascading Drop Down

The approach for loading multiple values based on the selection of another control is equally possible. In the same formula, replace the data source with your cascading query. In cascading, we just eliminate the unwanted data. In this approach we’re not concerned how the data is loaded, directly or via cascading. We’re just adding a new column, irrespective of the data source.

AddColumns(CascadingFilterQuery, "HybridColumn",If(IsBlank(FreindlyName) || IsEmpty(FreindlyName), Title, FreindlyName))

Key Takeaways

  • PowerApps does allow us to manipulate the data, before appending it to any control.
  • Data added to a drop down or, combo box is actually a collection. Hence, we can use all the PowerApps functions that can be applied to a collection.
  • The sample will also work with cascading controls as well.
  • The example shown above is loading the data conditionally from 2 columns. However, the possibilities are endless. We can also choose to combine 2 or more columns to display a unified text.
  • The important thing is that, the formula, for the new column, is in our hand and that, we can put any custom operation over there.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.