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 / Combo Box pre-populate...
Power Apps
Unanswered

Combo Box pre-populated with stored values

(0) ShareShare
ReportReport
Posted on by 33

Hi all,

I'm struggling to figure out how to populate a combo box with values that are stored in a table (currently Excel, but hopefully moving to a Dataverse table).  The scenario is:

 

I have a 'New' screen that contains a combo box (in an Edit form) that allows the user to select multiple values from a list of items.  That list of items is stored in an Excel table called 'Table6'.  When the user selects values and hits 'Save', the selected values are concatenated (using ";") and stored in a table called 'Table1', in column called 'Services'.  This all works fine.

 

The app also has an 'Edit' screen that contains a combo box (also in an Edit form).  I would like this combo box to retrieve the stored values so that the user can readily see the Services that are already associated with this customer.  The user s/b able to then select more (from the superset of items in 'Table6'), delete etc.  Selections would then be saved back to the same location in 'Table1'.

 

The combo box in question has Items = Table1.  Intuitively, I think I need to use DefaultSelectedItems.  And I also believe that I need to use the Split function (possibly with other functions) to get the stored values in a form that can be used in the combo box.  But I have been unsuccessful in getting this to work properly.

 

Do you have suggestions as to how I can accomplish this?

 

Thanks so much for any guidance...

Categories:
I have the same question (0)
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Marcusm what is the items property for the EditForm?

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Marcusm Just checking if you are still interested in getting a solution for this?

  • Marcusm Profile Picture
    33 on at

    Hi CNT, thanks so much, I was offline this weekend.  The Item property for the form itself is currently blank.  As indicated before, the Item property for the combo box itself is Table1.

    The stored values that I want to prepopulate the combo box with are in the 'Services' column in Table1.

     

    make sense?  

    thanks again for your help...

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Marcusm To select the values stored before, you will have to do a Split on the values retrieved from the 'Services' column in 'Table1'. If I assume that the retrieved values for the current record are in a variable called varRetrievedServices, the the following formula in the DefaultSelectedItems property of the ComboBox will preselect those items,

    Split(varRetrievedServices, ",")

     Relplace varRetrievedServices with the correct name.

     

    Please remember to give a 👍 and accept the solution as it will help others in the future.

  • Marcusm Profile Picture
    33 on at

    Thanks again.  Do I need to define the variable (varRetrievedServices) somewhere?  As is, when I type 

    Split(varRetrievedServices, ",")

     

    I get a couple errors.  Note that Table1 does have other columns, so I'm assuming I need to connect varRetrievedServices to the specific column I'm referencing?

    Marcusm_0-1622494008346.png

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Marcusm I was just giving an example. You could place this in the DefaultSelectedItems of the combobox,

     

     

    Split(Parent.Default, ",")

     

     

  • Marcusm Profile Picture
    33 on at

    @CNT, thanks.  Split(Parent.Default, ",") doesn't throw errors, and is intuitive to me.  But unfortunately it doesn't solve my issue.  I receive  'No item to display' when I run the app with this command.  I'm assuming this is because while the app understands that the "Parent" is the customer that I'm highlighting from Table1, I still haven't told it that I want the corresponding "Services" for that customer.  (I tried Parent.Default.Services but that didn't work). It still seems like I need to use Set or Collect etc, and then run Split on that variable or collection.

    I also tried:

    Set(varRetrievedServices, {ThisItem.Services}),
    Split(varRetrievedServices, ",")
  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Marcusm Is this ComboBox inside an EditForm? What is the Items property for this Edit Form?

  • Marcusm Profile Picture
    33 on at

    @CNT, yes, it's inside an Edit Form.  The Item property for the Form itself is blank.  The Item property for the combo box inside the Form is "Table1". 

    Also, your question prompted me to check the Default property for the DataCard - which is 'ThisItem.Services'.  So that would indicate that I have told the app to focus on the Services field and your original comments on the Split command should work (right?). 

    I know that the "No Item to Display" message can happen if the DisplayMode is set to 'view', but I've confirmed that DisplayMode is set to 'edit' in the Combo Box. 

     

    I went back to 

    Split(Parent.Default, ",")

    And I also tried with a ";" since that's the delimiter in the source table.  But in both cases I still get 'no item to display when I run the app.  (I also closed/reopened the app).  Am I missing something obvious?

     

  • CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Marcusm Well, you've said "The app also has an 'Edit' screen"

    You can't have an EditForm with Items property blank (that's why u'r getting 'no item to display'). You need to point it to the Record that you want to edit. If this is not set straight, the ComboBox will never work.

    Could you please share some of u'r screens.

     

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 June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 352 Most Valuable Professional

#2
11manish Profile Picture

11manish 192

#3
Valantis Profile Picture

Valantis 128

Last 30 days Overall leaderboard