cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Post Patron
Post Patron

Conditional fill formula

Hello,

 

My goal is to fill textboxes with different colors based on the values 1, 2, 3, 4.  The issue I'm struggling with being new to this is the text box will always have a letter next to the number e.g. 1a, 1b, 1c, 2a, 2b, 3a, 3b, etc...  Instead of hard coding the exact value, I'd rather create an If statement like,  If(DataCardValue123.Text includes a 1 then change text box fill to red, white).

3 REPLIES 3
Highlighted
Post Patron
Post Patron

Re: Conditional fill formula

See what I've come up with so far in the attachment.

Highlighted
Super User III
Super User III

Re: Conditional fill formula

@trishmalloy 

I would suggest checking the first character of the textbox value using the LEFT function and defining the conditional fill color using a SWITCH statement.

 

Switch
    Left(DataCardValue123.Text,1),
    "1", RGBA(some_color_here),
    "2", RGBA(some_color_here),
    "3", RGBA(some_color_here)
)

 

For example if your DataCard holds the value "1a" the function Left(DataCardValue123.Text,1) would evaluate to

 

"1"

 

Which activates this part of the SWITCH function

 

"1", RGBA(some_color_here),

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

Highlighted
Dual Super User II
Dual Super User II

Re: Conditional fill formula

Hi @trishmalloy 

 

Use Switch

 

Switch(Left( DataCardValue62_2.Text,1),"1",Red,"2",Green,Blue)

 

Replace the colors based on your scenario

 

--------------------------------------------------------------------------------
If this post helps answer your question, please click on “Accept as Solution” to help other members find it more quickly. If you thought this post was helpful, please give it a Thumbs Up.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (5,939)