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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Combobox default item ...
Power Apps
Unanswered

Combobox default item with description

(0) ShareShare
ReportReport
Posted on by 194

Hi All!

I have a combobox that is set to a database table and the layout of the combobox is double: primary text (ID column) and secondary text (description column)

 

I have a function on the screen to enter some data and based on filtering in the database pre-select the relevant item in the combobox with the ability to change it if needed. My issue is the default selected item is this:

 

 

Trim(Filter('TABLE', COLUMN = txtPO_1.Text && COLUMN2 = DataCardValue11_1.Text && COLUMN3 <> "Y").COLUMNID) 

 

 

It is working, but the combobox is only displaying the ID in the drop down and not the full drop down item that includes the description if I just did the drop down and selected it. The ID is correct. How do I set the default selected item to also include the combobox secondary text with it so people know what the ID means when it comes up? Thanks!

 

Update: Its not relevant to how i'm doing the defaultselecteditem. If i just pick an item from the drop down even with the secondary text in there to help me pick when i select one it just gives/shows the ID in the drop down not the full string with description. Is this even possible?

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Nicci - thanks for the image.

     

    As I understand it. you have what I assume is a SharePoint list. In that list is a field called ID, and another field called Description.

     

    In your App, you have a ComboBox control. The Layout property is set to double. "Primary text" has been set to ID, and "Secondary text" has been set to Description.

     

    In your ComboBox control, you have managed to display each item with ID and Description as concatenated text (e.g. "ID - Description").

     

    However, when selecting a Value from the ComboBox, only the ID column is displayed.

     

    Assuming the above is correct, then:

     

    1. How are you concatenating both the ID column and the Description field
    2. What do you have in the Items property of that ComboBox
  • Nicci Profile Picture
    194 on at

    Darn, not sure how else to describe it and the original post is still correct in what i'm trying to do, just without the defaultselected function being an issue. Here let me try visuals!

     

    Here is what my combox looks like: ID - Description (this is what i want)

    Nicci_0-1712750647393.png

     

     

    but when i select an option OR if it defaults to 011 (doesnt matter) it just looks like this in the box: 

     

    Nicci_1-1712750745800.png

     

    I want it to show the full information that is ID - Description.

     

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Nicci - I have read your reply a couple of times but unfortunately I can no longer understand what you're trying to do. I would suggest raising a new post. Hopefully someone else will be able to understand it.

  • Nicci Profile Picture
    194 on at

    Hello! My reasoning to say its irrelevant because its doing the same thing if I just manually select an option from the combobox so its not related to the defaultselected. It is matching so thats not the issue.

     

    If I click the drop down I seed something that looks like this "101 - Description" but after clicking it only "101" is displayed in the drop down. I want it to display the whole thing upon selecting. This is more of a display what is selected issue rather than the default since it acts the same way when manually clicking an option in the drop down, but in the database I want to save 101 only. I may just make a text field to display the description based on selection since the display in the combobox seems to only point to 1 column and if i make a custom column to display it now I have to change the update.

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @Nicci -

     

    I would disagree the problem is not relevant to the DefaultSelectedItem property.

     

    You have noted that the ComboBox control is just returning the table, whereas the formula you're using in the DefaultSelectedItems property will return a single column table called "Value".

     

    As a result, the schema returned in the Items property, and the schema returned in the DefaultSelectedItems property, no longer match.

     

    What you should be doing is returning a record. In the Items property of the ComboBox control, enter:

     

    AddColumns(
     'Table',
     "_TrimColumnID",
     Trim(COLUMNID)
    )

     

    In the DefaultSelectedItems property, use:

     

    Filter(
     AddColumns(
     'TABLE',
     "_TrimColumnID",
     Trim(COLUMNID)
     ),
     COLUMN = txtPO_1.Text && COLUMN2 = DataCardValue11_1.Text && COLUMN3 <> "Y"
    )

     

    Notes:

     

    1. You will need to select the custom column "_TrimColumnID" from the properties of the ComboBox (Primary text or Secondary text).

    2. If that custom column is not appearing, you might need to create a new ComboBox.

     

    Further reading on the difference between a Record and Value.

     

    https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/working-with-tables 

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 408

#2
WarrenBelz Profile Picture

WarrenBelz 382 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 328 Super User 2025 Season 2

Last 30 days Overall leaderboard