cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Change the color based on a value combo box

Hi all,

 

I'm doubting if this is possible in PowerApps. I have a simple lookup fields with a few value.

When some select "Sales", i want to change to color of the text or combo box to red, etc.

 

If(ThisItem.RecordType.Value = "Verkoop", Orange, ThisItem.RecordType.Value = "Risk", Red, ThisItem.RecordType.Value = "Dependency", Blue, Black)

I changed the color of the RecordType datacard but nothing happends. So, is it correct you can't change the color of a combo box with a sertain value?

 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Yes, fixed 🙂

 

If(
	DataCardValue2.Selected.Value = "Sales", Red,
	DataCardValue2.Selected.Value = "Invoice", Blue,
	Yellow)

View solution in original post

9 REPLIES 9
mdevaney
Super User III
Super User III

@Anonymous 

I would suggest changing the properties of the ComboBox itself instead of the DataCard.  Not all properties of the ComboBox are linked to the Parent DataCard by default.  Some suggested properties to change are Fill (background color), Color (text color) and Border (border Color).

 

Also, you might need to use the IN operator rather than the equals sign in your conditional statement.

 

If(
    "Verkoop" in ThisItem.RecordType.Value, Orange, 
    "Risk" in ThisItem.RecordType.Value, Red, 
    "Dependency" in ThisItem.RecordType.Value, Blue, 
    Black
)

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Anonymous
Not applicable

This formula uses scope, which is not presently supported for evaluation. Data type: Color.

Think this looks the problem when i use the IN operator 

Fair enough.  What happens when you use the equals operator but directly change the Fill, Color or Border properties of the ComboBox NOT the DataCard?

Anonymous
Not applicable

If(
    ThisItem.Bedrijfsunit.Value = "Verkoop",
    Orange,
    ThisItem.Bedrijfsunit.Value = "Eigendom",
    Red,
    ThisItem.Bedrijfsunit.Value = "Inkoop",
    Blue,
    Black
)

When i use this, the combox is and stays black, so it looks the code is only working for the black color. 

Very strange because the values are correct. 

 

Change color.png

@Anonymous 

Do you have any other options than .Value when the autocomplete appears?

 

You might also want to test by putting ThisItem.Bedrijfsunit.Value in the Text property of a label to see what it returns.  The label must be in the same DataCard as the ComboBox

 

Anonymous
Not applicable

Yes, fixed 🙂

 

If(
	DataCardValue2.Selected.Value = "Sales", Red,
	DataCardValue2.Selected.Value = "Invoice", Blue,
	Yellow)

View solution in original post

@Anonymous 

You said "its fixed."  Does this mean you issue was resolved?

Anonymous
Not applicable

Correct, with the If statement i got al my filled in colors 🙂

This worked perfectly for me, however I'm having another issue and I can't for the life of me figure out where this property is. The background color changes as I wish, however once the choice field has a selection made, that selection text is highlighted in gray. So if I select Green, the valuecard has a green background,  but the word "green" itself has a gray background. So ugly! Any idea what I might be missing? 

JennyJenn831_0-1605878526852.png

 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,885)