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.

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.