Combining 2 Columns

Sometimes it really helps to combine 2 columns to display in a dropdown control, for example if you have first and last names in separate columns

Its straightforward to do that by using the AddColumns function within the dropdown Items property to create a new column that exists only within the Dropdown control

Consider the case of a custom Subscriber table in Dataverse that contains the columns ‘First Name’ and ‘Last Name’ and we want to combine these to display the subscriber’s full name

To do that, add the following to the Items property of the Dropdown control

AddColumns(Subscribers,"Full Name", 'First Name' & " " & 'Last Name')

Now go to the Value property of the control and change it to the new column, and you will see it is now displayed in the Dropdown

display multiple columns in a dropdown control

The new column only exists within the Dropdown control, not in the data source or anywhere else in the app, but that is fine for our purposes

Whenever a selection is made using a dropdown, the whole record is selected. For example, if we wanted to find the subscribers email address, we would do so in the usual way

Dropdown1.Selected.Email

Summary

Combining 2 or more columns from the same table in a Dropdown control is done using the AddColumns function

The new column exists only within the Dropdown control and it can’t be directly referenced from elsewhere in the app, only via the Dropdown control and shown above

When selecting a Dropdown item, the whole record is selected and therefore we can access all other columns for that record in the usual way

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top