web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Question about combo b...
Power Apps
Unanswered

Question about combo box return value

(0) ShareShare
ReportReport
Posted on by 10

Hi all,

As context for this post, I want to refer to the solution of Kris Dai on this earlier post of mine:
https://powerusers.microsoft.com/t5/Building-Power-Apps/Need-help-with-a-dropdown-combo-box/m-p/437489#M129738

To summarize my other post I need a drop down that displays a text value, but returns the ID of the selected text value. With the answer of Kris Dai, it was possible to do this. I've tried to replicate this solution on other drop downs to no avail.

As I am not quite handy in PowerApps, the connection I have to make in order to display what I need in SQL would look something like this:
select bc.branchclusterid, bc.clusternamelong
from branch b
inner join vwbranchclusterinfo bc
on bc.branchclusterid = b.branchclusterid

BranchclusterID of course is the primary key of the BC table and ClusterNameLong is a concatenation of the cluster name + the country of that cluster. As you can see, I am joining onto a view.

The solution Kris Dai proposed makes me connect to a dimension table by changing three properties, one in the data card and two on the combo box itself. Please keep in mind although this is not the same combo box/tables I am using, the idea stays the same. The form I am using is using the Branch table as a source.

Items property in the combo box

 

ShowColumns('[dbo].[BranchElement]', "BranchElementId", "ElementText")

 


DefaultSelectedItems property in the combo box

{
 ElementText: LookUp('[dbo].[BranchElement]', BranchElementId = ThisItem.BranchClusterId, ElementText)
}


Update property on the data card

BranchClusterIdComboBox.Selected.BranchElementId

For this solution I also have to change the search & display field to show ElementText.

This solution works great on that combo box, however, I run into a problem when I try to replicate it using a view.
This is how I connect to the view (in the same way):

Items property on the combo box
ShowColumns('[dbo].[vwBranchClusterInfo]', "BranchClusterId", "ClusterNameLong")

DefaultSelectedItems property on the combo box
{
ElementText: LookUp('[dbo].[vwBranchClusterInfo]', BranchClusterId = ThisItem.BranchClusterId, ClusterNameLong)
}

Update property on the data card
DataCardValue10_2.Selected.BranchClusterId

Both the display and search fields contain the ClusterNameLong.

In the image below, you can see the combo box exhibiting problem 1 (explained below). The highlighted label has the same property as the Update on the data card, DataCardValue10_2.Selected.BranchClusterId.

image.png

Problem 1: Combo box connected to view returns no values
Problem 2: View sometimes provides no data inside the combo box

Is there something I am doing wrong? Does PowerApps differentiate between tables and views? Would appreciate any feedback/help. If anything is unclear please let me know.


Categories:
  • v-yutliu-msft Profile Picture
    Microsoft Employee on at

    Hi @DiegoJ ,

    Could you tell me the data type of BranchClusterId field?

    Please set the combo box's DefaultSelectedItems property:

    {
    ClusterNameLong: LookUp('[dbo].[vwBranchClusterInfo]', BranchClusterId = ThisItem.BranchClusterId, ClusterNameLong),
    BranchClusterId:ThisItem.BranchClusterId
    }

     What's more, SQL view and SQL table only has one difference:

    view is read-only, you could only search and read data in sql view, you could not write data in sql view.

    While you could read and write sql table.

     

     

     

    Best regards,

  • DiegoJ Profile Picture
    10 on at

    Hi @v-yutliu-msft,

    The BranchClusterId is an INT field.

    I have done your suggested change, but it doesn't change anything.

    Thanks for your clarification on table vs. views, I'm currently writing in a physical table so I would assume my use of a view is okay.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 395 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 260 Most Valuable Professional

Last 30 days Overall leaderboard