cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Greg68
Helper III
Helper III

Fill Switch with empty value

Hello everyone,

 

I'm using function Switch to fill a label with certain values and it works, but when the value is blank is it is colored in black, anyone have an idea how to do to fill the blank as well?

 

Thanks a lot

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@Greg68 

Without knowing your formula you are using, you can simply supply a Default to the Switch function.

The very last parameter to Switch is the Default/Else of the statement.

Ex.

 

Switch(Self.Text,
    "Something", Red,
    "Big", Yellow,
    "Hi", Black,
    Green
)

In this case, Green is the color that will be returned because nothing matched.  In your case, the blank would fall into that scenario.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

3 REPLIES 3
RandyHayes
Super User
Super User

@Greg68 

Without knowing your formula you are using, you can simply supply a Default to the Switch function.

The very last parameter to Switch is the Default/Else of the statement.

Ex.

 

Switch(Self.Text,
    "Something", Red,
    "Big", Yellow,
    "Hi", Black,
    Green
)

In this case, Green is the color that will be returned because nothing matched.  In your case, the blank would fall into that scenario.

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
victorcp
Solution Sage
Solution Sage

Probably you didn't set the default value in your switch:

Switch(
    <Value>,
    <condition1>,<Color1>,
    <condition2>,<Color2>,
    <default_Color>
)

 

Thanks @RandyHayes  This works, I missed that.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors
Users online (1,415)