web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change fill colour of ...
Power Apps
Unanswered

Change fill colour of label based on other labels numbers

(0) ShareShare
ReportReport
Posted on by 45

Hi Everyone, 

 

Inside  a form, I have a datacard (from a SPL) where i'm displaying the result inside a Textinput called 'TxtRisk' of a multiplication from 2 dropdowns following that into default properties:

Text(DrpRealOcc.Selected.Score*DrpRealImp.Selected.Score)

So inside the texinput i have a score as number between 1 and 20.

Following that score, I wanted to have a  rectangle inside the gallery for these forms, been filled following the a color, something like :
Between 1 and 4 Green
Between 5 and 9 Orange
Between 10 and 20 Red.

The thing is I tried several ways, such as the switch, command, or the IF but for both I have errors, and not able to display color.

Could someone give a hand on that?, much appreciated

Categories:
  • Michael_Scott Profile Picture
    106 on at

    This can be done using an if statment like so...

    If(value >= 1 && value <= 4, Green, If(value >= 5 && value <= 9, Orange, If(value >= 10 && value <= 20, red)))

     

    if this solves your issue please mark as the solution!

  • carltoune33 Profile Picture
    45 on at

    this thing is that when I'm copying this into fill properties of the rectangle i don't have the choice to take value of the textinput selection 😪.

  • Michael_Scott Profile Picture
    106 on at

    Im not sure I follow. You are able to let the user select 2 values from dropdowns,  you then multiply those 2 numbers together and display it in a textinput. You then want the color to change based on the value that is in that text input box correct?

  • carltoune33 Profile Picture
    45 on at

    That’s correct until the color part.

    i want to color a rectangle that is inside the gallery collecting all the submitted forms, to display clearly the value associated with color, hope this is more clear.

    it’s not the textinput itself that I want to color.

  • Michael_Scott Profile Picture
    106 on at

    so you want to display the word "Green" or the RGBA value for the color green or something instead of changing the color of the control? Sorry for the confusion! Any images or code you can share to help us understand exacltly what you want would be nice as well! We will get it figured out.

  • carltoune33 Profile Picture
    45 on at

    Hello, 

    So here are the datacards used

    carltoune33_0-1673592148115.png

    inside the Result risk textinput in the default properties i have the following code

    Text(DrpRealOcc.Selected.Score*DrpRealImp.Selected.Score)

     this takes the information from 2 SPL as follow

    carltoune33_1-1673592291583.pngcarltoune33_2-1673592330828.png

    So inside the texinput i have the result of the multiplication, this is working fine.

     

    Then inside the gallery, i'm displaying some short information before entering the view mode of each forms, and i want to have the bleu rectangle fill color matching to the score that is calculated into the form texinput to have a quick way to see what is critical to handle.

    carltoune33_3-1673592641803.png

     

    Between 1 and 4 Green
    Between 5 and 9 Orange
    Between 10 and 20 Red.

    what you have share is almost working, as i tried this formula into the fill property of the rectangle

    If(Value(TxtRisk.Text) >= 1 && Value(TxtRisk.Text) <= 4, Green)

    using that one, when i'm in the form and choosing calculation where the result is between 1 & 4, all the rectangle went to green, but what I want is to display the current value of the risk, not the one that I'm currently filling before submitting the form.

    Hope it is more clear, and thanks for your help.

  • carltoune33 Profile Picture
    45 on at

    @Michael_Scott any thoughts?

     

    thanks 

  • carltoune33 Profile Picture
    45 on at

    Hi all, 

     

    is there someone that could help me here?

     

    thanks a lot

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard