cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
iwonder
Post Prodigy
Post Prodigy

Checking Combobox Values

Thank you for taking the time to read my question.

 

I have an edit for and I want to change the color of a Combobox border if the value in the ComboBox does not match the saved value;

 

PelMed = ComboBox

 

If(frmPelleting.Mode = FormMode.Edit && ThisItem.Medication <> Concat(PelMed.SelectedItems,Title,","),Orange, Parent.BorderColor)

 

 

This does not work because Concat(PelMed.SelectedItems,Title,",") returns a list of commas I'm finding.

 

I've read that SelectedItems does not equal DefaultSelectedItems... and SelectedItems does not get set until the user interacts with the ComboBox.

 

I also tried Concat(PelMed.DefaultSelectedItems,",") but there is no such thing...

 

How do I tell if the user made a change to the ComboBox vs. the previously saved record?

 

Thanks

12 REPLIES 12
StalinPonnusamy
Community Champion
Community Champion

  1. Please share your Combobox items property
  2. Concat(PelMed.SelectedItems.Value,Value,",") - Does this produce anything?

 

Hi @StalinPonnusamy 

 

Here is the Items code:

 

 

Filter(Medication,Or(MedicationFacility = SelectedFacility.Text,MedicationFacility = "All"),Or(MedicationLine = BagLine.Selected.Line,MedicationLine = "All"),IsActive).Title

 

 

 

I get Red Underline if I change Title to Value.

 

Thanks!

 

 

EDIT

 

Not sure if this is helpful, but the DefaultSelectedItems = 

 

 

RenameColumns(Filter(Split(Parent.Default,","),!IsBlank(Result)),"Result","Value")

 

And when I expand the ComboBox, the values in the DefaultSelectedItems for the ComboBox are not highlighted... like there is a disconnect somewhere...

 

Maybe that's why I'm not getting anything when I use Concat() on the ComboBoxes SelectedItems field?

 

Thanks

 

Ok, I have it!

 

Power Apps Combo Box DefaultSelectedItems - YouTube - Here Shane makes an important point at 3:10 of the video. The data source has to be the same table for DefaultSelectedItems and Items. That's where my solution fell apart.

 

So I changed my DefaultSelectedItems to:

//RenameColumns(Filter(Split(Parent.Default,","),!IsBlank(Result)),"Result","Value")
Filter(Medication,Title in Split(Parent.Default,",").Result,MedicationFacility = SelectedFacility.Text, MedicationLine = PelLine.Selected.Line)

 

Then I changed my BorderColor formula to:

If(frmPelleting.Mode=FormMode.Edit && ThisItem.Medication <> Concat(PelMed.SelectedItems.Title,Title & ","),Orange, Parent.BorderColor)

 

Voila!! no more Orange border.

 

Thank you so much @StalinPonnusamy  for all your replies to my post. I really appreciate it.

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (2,877)