cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Wackmack88
Level 8

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
Wackmack88
Level 8

Re: Change the color based on a value combo box

Yes, fixed 🙂

 

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

View solution in original post

8 REPLIES 8
mdevaney
Level 8

Re: Change the color based on a value combo box

@Wackmack88 

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."

Wackmack88
Level 8

Re: Change the color based on a value combo box

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 

Highlighted
mdevaney
Level 8

Re: Change the color based on a value combo box

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?

Wackmack88
Level 8

Re: Change the color based on a value combo box

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

mdevaney
Level 8

Re: Change the color based on a value combo box

@Wackmack88 

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

 

Wackmack88
Level 8

Re: Change the color based on a value combo box

Yes, fixed 🙂

 

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

View solution in original post

mdevaney
Level 8

Re: Change the color based on a value combo box

@Wackmack88 

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

Wackmack88
Level 8

Re: Change the color based on a value combo box

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

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors
Users Online
Currently online: 211 members 5,147 guests
Please welcome our newest community members: