Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Combobox only has 1 item: DefaultSelectedItems make it select that item

(1) ShareShare
ReportReport
Posted on by 749

So I have several Comboboxes that have their items populated like so:

Table({Value: IfError(Index(Split(DataCardValue2.Text; " "); 1).Value; "")})

Meaning, theres a Textinput that the user will put a lot of numbers, separated by a space. Example: user inputs into DataCardValue2 "123 1234 12345", so Comboboxes 1 2 and 3 should have a single item of "123" "1234" "12345", respectively.

I need to edit the DefaultSelectedItems property of all of these databoxes so that each selects the singular first item they have. 

How can I edit that property to make it so?

Ty in advance 😄

  • WorkingRicardo Profile Picture
    749 on at
    Re: Combobox only has 1 item: DefaultSelectedItems make it select that item

    Hey @SidJohri and @ANB 

    Thank you for your replies! Both solutions worked for me. So I'll chose any of those randomly haha (didn't get the delegation problem)

    This is the only way I figured out how to block text to be copied from my app. As we want users to be able to access the info, but at least make it hard for them to extract data. With text labels, even if adding a transparent rectangle, you can still copy Textlabel content with Ctr+A (select all). Selected items in combobox bypasses the Ctr+A. 

  • Verified answer
    SidJohri Profile Picture
    24 on at
    Re: Combobox only has 1 item: DefaultSelectedItems make it select that item

    Hi @WorkingRicardo ,

     

    Trying to refer to a combox's Items property in its own DefaultSelectedItems property would create a circular reference which Power Apps will not allow. So, what you'll want to do is essentially repeat the Items property formula in the DefaultSelectedItems property and take the First() item from the table.

     

    Combobox1.DefaultSelectedItems = First(Table({Value: IfError(Index(Split(DataCardValue2.Text; " "); 1).Value; "")}))

    Combobox2.DefaultSelectedItems = First(Table({Value: IfError(Index(Split(DataCardValue2.Text; " "); 2).Value; "")}))

    etc.

     

    As an aside, what is the use case for a combobox to display a single item. Why not simply use a label to do so?

     

    Hope this helps,

      -- Sid.

     

    ---------

    Please click Accept as solution if my post solved your issue. This will help others find it more easily. If my solution was helpful in other ways, please consider giving it a Thumbs Up.

     

  • Verified answer
    ANB Profile Picture
    7,075 Super User 2025 Season 1 on at
    Re: Combobox only has 1 item: DefaultSelectedItems make it select that item

    Hi @WorkingRicardo , Try this: 

    {Value: First(Split(DataCardValue2.Text; " "))}

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,660 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard