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 / How do I set a Combo B...
Power Apps
Answered

How do I set a Combo Box's default items to a string from a SharePoint text field?

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a Combo Box pulling from a SharePoint list. When items are selected from the Combo Box, the IDs for the items are loaded into a SharePoint text field called "Categories" via a CONCAT function that loads as text into an Edit Form. The output is currently a string like the following: 1;2;3

 

I want to set the default selected item/items for the Combo Box to be whatever the contents are of the Categories text field in the SP list for the current gallery item. So, if the string is 1;2;3, I would like to have the SharePoint list items with the IDs of 1, 2, and 3 selected in the Combo Box.

 

Any help would be profoundly appreciated.

Categories:
  • Verified answer
    mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    Categories is a text field and we can reference it like this inside a form

    ThisItem.Categories

     

    We need to convert the text string into a single column table of values for use in a FILTER function.  For example if we have this text string...

    1;2;3

     

    ...the SPLIT function can be used to change the data type to Table... 

    Split(ThisItem.Categories,";")

     

    ...and the result will look like this.

    [1,2,3]

     

    With this knowledge we can combined the SPLIT technique we just used with FILTER to look IN the dataset and retrieve the desired records.  From what I understand category is actually a reference to ID in another table.  Put this code in the DefaultSelectedItems of your ComboBox.

    Filter(
     your_datasource_name,
     ID in Split(ThisItem.Categories,";")
    )

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    Did my post answer your question?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney, my apologies. My schedule has not yet allowed me to test out your solution. I imagine it will as it makes sense in terms of how Power Apps understands the data and data type. I will test when I can and post back.

     

    Thanks for taking the time to propose it.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    Sounds good to me.  Just wanted to make sure the response was helpful.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @mdevaney , this worked perfectly. Now I just have to figure out how to ensure the default selected items value gets cleared when I click to clear the filter. I imagine I will need to variablize the code you provided.

  • mdevaney Profile Picture
    29,993 Moderator on at

    @Anonymous 

    Yes you would have to variabilize it.  I think you've made up a new word here.  I like it!

     

    Put this code in the OnVisible property of your screen.  Also put this same code in the OnHidden property of the screen.

    Set(clearComboBox,false)

     

    Change the DefaultSelectedItems to this code

    If(
     clearComboBox=true,
     Blank(),
     Filter(
     your_datasource_name,
     ID in Split(ThisItem.Categories,";")
     )
    )

     

    Finally, include this code in your button to clear the form

    Reset(ComboBox1);
    Set(clearComboBox,true);

     

    ---
    Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

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 248 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 192 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 135

Last 30 days Overall leaderboard