Skip to main content

Notifications

Power Apps - Building Power Apps
Suggested answer

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

Posted on 26 Nov 2024 21:44:44 by 739
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});
 
  • futr_vision Profile Picture
    futr_vision 739 on 27 Nov 2024 at 00:04:40
    Need help getting a label populating with the selected value of a combo box
     
    Added
  • Pstork1 Profile Picture
    Pstork1 63,797 on 26 Nov 2024 at 23:35:14
    Need help getting a label populating with the selected value of a combo box
    @futr_vision Your screenshot didn't come through in your last response.
  • futr_vision Profile Picture
    futr_vision 739 on 26 Nov 2024 at 23:23:19
    Need help getting a label populating with the selected value of a combo box
     
    It's not set to multi select. This is what I see when I click on Selected
     
     
  • Pstork1 Profile Picture
    Pstork1 63,797 on 26 Nov 2024 at 23:11:48
    Need help getting a label populating with the selected value of a combo box
    @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
    futr_vision 739 on 26 Nov 2024 at 22:57:02
    Need help getting a label populating with the selected value of a combo box
     
    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)
     
  • futr_vision Profile Picture
    futr_vision 739 on 26 Nov 2024 at 22:55:28
    Need help getting a label populating with the selected value of a combo box
     
    Value isn't recognized when I use it. 
     
  • ronaldwalcott Profile Picture
    ronaldwalcott 764 on 26 Nov 2024 at 22:31:12
    Need help getting a label populating with the selected value of a combo box
    What are your item definitions for the combobox, does it match the format used for the defaultselecteditems?
  • Suggested answer
    Pstork1 Profile Picture
    Pstork1 63,797 on 26 Nov 2024 at 22:15:16
    Need help getting a label populating with the selected value of a combo box
    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

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

November 2024 Newsletter…

November 2024 Community Newsletter…

Community Update Oct 28…

Power Platform Community Update…

Tuesday Tip #7 Community Profile Tips…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 143,129

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,797

Leaderboard