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 / Fill a ComboBox accord...
Power Apps
Unanswered

Fill a ComboBox according to a value

(0) ShareShare
ReportReport
Posted on by 26

Hello !

 

I work on an application linked with a SharePoint list.

 

I have a Label, which is pre-filled by an ID I send from another screen:

LookUp('Maintenance DI',ID_Demande = lblIdDemandePass.Text, ID_Demande)

This return the value of ID_Demande corresponding to lblIdDemandePass.

 

My problem is that I want to do the same in a comboBox, but it doesn't work:

Axel49_0-1676371405290.png

I want to do this in a comboBox because the user can choose between some choices.

But I also need to pre-fill the field if there is already a value corresponding to my ID_Demande.

 

How can I do to put value by default according to an ID in a comboBox?

 

Thanks in advance 🙂 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    Hi @Axel49 ,

    Two things here - the code you posted does not need the lookup as you are simply returning the same value as the Label (so why bother?).  Also you did not post the Items of the Combo Box, but you need the DefaultSelectedItems to refer to the Table field displayed, so whatever ComboBox.Selected.xxxx is, you need

    {xxxx: lblIdDemandePass.Text}

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

     

     

  • Axel49 Profile Picture
    26 on at

    Thanks for your answer.

    The Items of my comboBox is "Service".

     

    But I need to show in my comboBox the value of "Service", when lblIdDemandePass.Text is equal to my ID_Demande.

    For exemple, if my ID_Demande is 7, in my SharePoint list the "Service" corresponding to this ID is ABC.

    So the comboBox need to display ABC.

     

    I don't know if it's enought clear for you 🙂

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    @Axel49 ,

    Yes, but you have not provided the Items of the Combo Box, so I will use xxxx again for the DefaultSelectedItems

    {
     xxxx:
     LookUp(
     'Maintenance DI',
     ID_Demande = lblIdDemandePass.Text
     ).Service
    }

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • Axel49 Profile Picture
    26 on at

    I don't understand why did you mean by Items, this?

    Axel49_0-1676378165492.png

    And so for the DefaultSelectedItems I do  this:

    {
     Service:
     LookUp(
     'Maintenance DI',
     ID_Demande = lblIdDemandePass.Text
     ).Service
    }

    But it doesn't seem to work sorry.

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    @Axel49 ,

    You simply need to replace xxxx with the field name that is displayed in the Combo Box - is Service a data source or field name ?

  • Axel49 Profile Picture
    26 on at

    Hi,

     

    Service is a data source, it's the name of my SharePoint list.

    The name of the comboBox is cmbService.

  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    @Axel49 ,

    OK I will try asking the question in a different way - what is the field name displayed in your Combo Box so that when you refer to it (ComboBox.Selected.xxxx) it is xxxx (if Service is the name of your Data Source, what is the field name in it you are displaying). Quite simply that needs to be xxxx in the formula and yyyy is the field you are querying in your lookup in 'Maintenance DI'

    {
     xxxx:
     LookUp(
     'Maintenance DI',
     ID_Demande = lblIdDemandePass.Text
     ).yyyy
    }

     

  • Axel49 Profile Picture
    26 on at

    Okay I got it, the fact is that is the same name for both:

     

    cmbService.Selected.Service

     

    This is what I use when I want to refer to my comboBox.

    And also the name of my field in my list is Service. So it look like this:

    {
     Service:
     LookUp(
     'Maintenance DI',
     ID_Demande = lblIdDemandePass.Text
     ).Service
    }
  • WarrenBelz Profile Picture
    156,382 Most Valuable Professional on at

    @Axel49 ,

    See if it works, but there is potential for Ambiguity doing what you have - you may have to rename one of them - you will need to delete and add a new one as Power Apps remembers the original name.

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

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 416 Most Valuable Professional

#2
11manish Profile Picture

11manish 205 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 128 Super User 2026 Season 2

Last 30 days Overall leaderboard