Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

DefaultSelectedItems for a ComboBox not behaving as expected

(0) ShareShare
ReportReport
Posted on by 82

Hello all.

So I have a screen on an app that looks like this:

jojos_iq_0-1678241456121.png

The problem I am having is that the AssigneeTriggerColumn (which is a choice column in a SharePoint list called Hazards) is not auto-filling with options. How it works is:

  • If the Second Assignee dropdown is empty, set the AssigneeTriggerColumn choice to "NewAssignee"
  • If the Current Assignee dropdown is empty, set the AssigneeTriggerColumn choice to "SecondAssignee"
  • Else, set the AssigneeTriggerColumn choice to "NewPlusOne"
  • Both Assignee dropdowns are People and Group columns from the same SharePoint list called Hazards

When I load into the page, the value is immediately on "AssigneeTriggerColumn" is set as NewPlusOne, which is expected behaviour. However when I populate either the CurrentAssignee or SecondAssignee boxes, the AssigneeTriggerColumn dropdown doesn't change. It only changes when the value is removed from the column - the AssigneeTriggerColumn starts auto-filling as expected. I just want to know why it starts working properly, but only after I remove the values?!?! Below is my code:

 

//Auto-fill with a choice, dependant on what boxes have values
If(IsEmpty(SecondAssigneeBox.SelectedItems), LookUp(Choices(Hazards.AssigneeTriggerColumn),Value="NewAssignee"), If(IsEmpty(CurrentAssigneeBox.SelectedItems), LookUp(Choices(Hazards.AssigneeTriggerColumn),Value="SecondAssignee"), LookUp(Choices(Hazards.AssigneeTriggerColumn),Value="NewPlusOne")))

 

 

Please help! Thank you 😊 - also, feel free to ask me any questions about the app if you need any clarification on anything!

  • Re: DefaultSelectedItems for a ComboBox not behaving as expected

    Hi @jojos_iq,

    The Value part is a paticular format of the Choice column to set the DefaultSelectedItems property of the ComboBox.

    Generally, we will format as below:

    {Value:Specific_Value_Form_Choice_Field}
  • jojos_iq Profile Picture
    jojos_iq 82 on at
    Re: DefaultSelectedItems for a ComboBox not behaving as expected

    The ComboBox does not allow multiselect and I have tried your code - it worked!

    My day has only just started, but you have just made it 😊 - thank you so much! Could I ask you what the value part of the formula refers to? I don't really understand everything between the curly braces.

  • Verified answer
    Re: DefaultSelectedItems for a ComboBox not behaving as expected

    Hi @jojos_iq,

    Could you please tell me that if both ComboBox allow multi select or not?

     

    If sometimes you only select one item, the following formula could work:

    If(IsBlank(SecondAssigneeBox.Selected),{Value:"NewAssignee"},IsBlank(CurrentAssigneeBox.Selected),{Value:"SecondAssignee"},{Value:"NewPlusOne"})

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,304

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard