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 / Set Gallery ComboBox D...
Power Apps
Unanswered

Set Gallery ComboBox DefaultSelectedItem based on if value is already part of collection

(0) ShareShare
ReportReport
Posted on by 11

Hey PowerApp peeps, 

 

Hoping someone can help me with two issues. 

 

I have an edit form connected to a SharePoint List called "Hazard Assessments".

Within one of my data cards is a vertical gallery (Gallery_Hazard) that has a combo box (ComboBox_PickHzd), a text input control (TextInput_AddPlantoElim), and save button (Icon_Save).

The user will select a choice from ComboBox then they write a blurb in the TextInput. When they push the Icon_Save it adds both items to a collection (colEliminate) and creates a new record within the gallery. 

 

My ComboBox Items property is set to the following to allow my user to add a custom choice into the ComboBox.  

Ungroup(Table({DropDownOptions: Choices([@'Hazard Assessment'].PreLoaded_Hazards0)}, {DropDownOptions: [" Other"]}),"DropDownOptions"). 
 
Gallery Items property: colHazards 
 
Icon_Save OnSelect property:
ClearCollect(colEliminate, ThisItem, {Hazards: Label2.Text, Eliminate: TextInput_AddPlanToElim.Text}); Collect(colHazards, varNewRecord)
I should mention the Label2 in the above formula is referencing a text label that pulls the info from the ComboBox selection or the custom value they have added (depending on if they add a new choice or select from the list).
The formula is: 
If(ComboBox_PickHzd.Selected.Value = " Other", TextInput_Add_Hazard.Text, ComboBox_PickHzd.Selected.Value)
 
colHazards has one column set to "Value"
colEliminate has two columns set to "Hazards" & "Eliminate"
 
HPax_0-1705597552280.png

 

First Issue: 
I want the ComboBox DefaultSelectedItem to be the Parent.Default (set in my SharePoint list) but only if hasn't been added to the collection already. Otherwise I don't want it to select a default. 
 
Second Issue: 
This may be solved by the above issue, but if the DefaultSelectedItem referenced above is automatically selected, I want a specific text to be automatically filled into the text input. Otherwise, I want it to remain blank.  
 
I've been able to make some formula's sort of work, but they're either glitchy or they don't apply to all the items in the gallery. 
 
Hopefully someone has an idea to help me. 
 
Thanks in advance!
Categories:
I have the same question (0)
  • HPax Profile Picture
    11 on at

    Any help is really appreciated!! Please let me know if you need anymore info. 

    Thanks again!

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 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard