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 / Need help getting a la...
Power Apps
Suggested Answer

Need help getting a label populating with the selected value of a combo box

(0) ShareShare
ReportReport
Posted on by 831 Moderator
This is a relatively easy thing to do typically. Simply drop the label and change the text property to something like ComboBox.Selected.RecordName. That usually works. But in my situation it fails. 
 
Here is my issue. I am populating a form with data from a global variable. Now, the form gets populated as expected. The problem is that I have labels that look for the selected value and most work with the exception of the dependent combo boxes. These combo boxes are using code that looks like this for their DefaultSelectedItems.
 
{
 Value:
 If(
 varResetSubLedger,
 Blank(),
 Parent.Default
 )
 }
Now, there is a value in the combo box. Rolling over the Parent.Default in the code above shows me the expected value but the label doesn't show the selected value. The label is using this code.
CB_SubLedger.Selected.'Sub Ledger Name'
Rolling over 'Sub Ledger Name', in the previous code, says the selected value is blank. My other labels, not associated with child/dependent combo boxes, return a value. Seems like there is some issue with how I set the DefaultSelectdItems. I think.  Anyone have an idea what is going on?
 
NOTE: For reference, I am checking varResetSubLedger because the parent is using this for the OnChange property
 
UpdateContext({varResetSubLedger: false});
UpdateContext({varResetSubLedger: true});
 
Categories:
  • Suggested answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    You are populating the combobox with a record based on Value: So that should be the name of the property that you reference in the Label.  Try the following:
     
    CB_SubLedger.Selected.Value
  • ronaldwalcott Profile Picture
    3,914 Moderator on at
    What are your item definitions for the combobox, does it match the format used for the defaultselecteditems?
  • futr_vision Profile Picture
    831 Moderator on at
     
    Value isn't recognized when I use it. 
     
  • futr_vision Profile Picture
    831 Moderator on at
     
    The item definition for the child combo box
     
    Sort(Filter('Cost Center Sub Ledgers', 'Cost Center Name' = CB_CostCenter.Selected.'Cost Center Name'), 'Sub Ledger Name' ,SortOrder.Ascending)
     
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    @futr_vision Is the Combobox set for Multiple Selections? If you click on Selected in the code what does Intellisense show you?  
  • futr_vision Profile Picture
    831 Moderator on at
     
    It's not set to multi select. This is what I see when I click on Selected
     
     
  • Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    @futr_vision Your screenshot didn't come through in your last response.
  • futr_vision Profile Picture
    831 Moderator on at
     
    Added
  • Suggested answer
    Pstork1 Profile Picture
    69,665 Most Valuable Professional on at
    If you click on the dropdown next to the spot where it says selected is a Record you should see the key value pairs included in the record. One of them will be the text you want to be in the label.  You need to use the Key that is next to that text.
  • futr_vision Profile Picture
    831 Moderator on at
     
    That really doesn't help. The label is looking for data but what it finds is blank even thought there is a value in the combo box. The Parent.Default, when looking at this code in DefaultSelectedItems for the combo box, is text in this case
     
     
    I guess the label is looking for a record which I think implies I need to update the code to return a record since it looks like it isn't. It's just returning code
     
     

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 342 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 283

#3
Mohsin Ali Profile Picture

Mohsin Ali 221

Last 30 days Overall leaderboard