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 / combobox default selec...
Power Apps
Answered

combobox default selected items populated with colmn a if its not empty or column b if it is

(0) ShareShare
ReportReport
Posted on by 61

So i have a combobox that i want to populate default items from a colum if there is an entry or from an alternative if there isnt. 

 

If(IsEmpty(LookUp('CHEMY Room matrix','Room No.'=DataCardValue11.Selected.Value).'Delegate or Group Email'), LookUp('CHEMY Room matrix','Room No.'=DataCardValue11.Selected.Value).'Room or Area RP')

 

this works unless there is an entry in the 'delegate' column in which case its blank. Any suggestions? 

 

TIA

Categories:
  • WarrenBelz Profile Picture
    156,963 Most Valuable Professional on at

    Hi @RiKx ,
    Assuming the output of your Combo Box is .Value (change if not) and both 'Delegate or Group Email' and 'Room or Area RP' are both Text fields, try this

    {
     Value:
     With(
     {
     wRoom:
     LookUp(
     'CHEMY Room matrix',
     'Room No.' = DataCardValue11.Selected.Value
     )
     },
     Coalesce(
     wRoom.'Delegate or Group Email',
     wRoom.'Room or Area RP'
     )
     )
    }

     

    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

  • RiKx Profile Picture
    61 on at

    They are people or groups columns if that makes a difference? Many thanks for the reply!

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

    Hi @RiKx ,

    If those two columns at the bottom are both Person/Group fields, you would need

    Coalesce(
     wRoom.'Delegate or Group Email'.DisplayName,
     wRoom.'Room or Area RP'.DisplayName
    )

     

    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

  • RiKx Profile Picture
    61 on at

    {
    Value:
    With(
    {
    wRoom:
    LookUp(
    'CHEMY Room matrix',
    'Room No.' = DataCardValue11.Selected.Value
    )
    },
    Coalesce(
    wRoom.'Delegate or Group Email'.DisplayName,
    wRoom.'Room or Area RP'.DisplayName)
    )
    }

     

    isn't returning any response unfortunately 😞 any other suggestions? Thanks again for help

     

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

    @RiKx ,

    You structure is rather unusual and I can only be guided by what you have posted - my assumptions are

    • You are looking up the list 'CHEMY Room matrix' for the first record where the 'Room No.' equals the value selected in DataCardValue11
    • This record has two Person fields Delegate or Group Email' and 'Room or Area RP' and you are looking in that order for the first non-blank value in the DisplayName of these fields
    • If a value exists you are then sending that value back to the DefaultSelectedItems of a single selection Combo Box

    If all of that is correct, the code should do the job.

  • RiKx Profile Picture
    61 on at

    That's correct! 

     

    I typed the code in rather than C+V and its now showing this...

    RiKx_0-1688988412318.png

     

  • RiKx Profile Picture
    61 on at

    With({wRoom:LookUp('CHEMY Room matrix','Room No.' = DataCardValue11.Selected.Value)},Coalesce(wRoom.'Delegate or Group Email', wRoom.'Room or Area RP'))

     

    removing the {Value:} statement results in the 'delegate or group email' displaying but not 'Room or Area RP'...

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

    @RiKx ,

    Those people columns must be multi-select as they produce a Table. If you put them back to single select, that code will work. You need {Value: . . . in the DefaultSelectedItems of a Combo Box assuming the Items produce this output field.

  • RiKx Profile Picture
    61 on at

    Hmmm

     

    Is there a way to get it to work for multiple entries? (there are shared spaces)

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

    @RiKx ,

    So what do you expect to see in the default choice - it can only contain one value (not a Table)

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

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard