cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Taylope1
Helper II
Helper II

Fill colours not working as needed

In the screenshot you can see 3 items.   1 is Approved, 1 Rejected and 1 Conditional.

 

I want the fill for each item to change based on that Status Field. Status is the DataCardValue18 in the code below.

 

Here is my fill property - Switch(DataCardValue18.Selected.Value,"Approved",RGBA(127, 178, 57, 1),Switch(DataCardValue18.Selected.Value,"Rejected",RGBA( 255, 0, 0, 1 ),RGBA(255, 140, 0, 1)))

 

I've tried "If" as well but same result.   Now if I click on one that says Rejected (should be Red Fill), when I come back from its details to the browser screen (as shown) they will all then turn Red.

 

Help appreciated.  Thx

1 ACCEPTED SOLUTION

Accepted Solutions

I just tested and confirmed on my end that it only changes once selected using the background referencing the label and that using ThisItem. no longer works for rows... very interesting!

 

Ok, so workaround for this would be to create a label in the background (note its layered position in the gallery on the left), and then have it's fill based on that same formula - tested this and it works:

image.png

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


View solution in original post

6 REPLIES 6
RezaDorrani
Dual Super User
Dual Super User

Hi @Taylope1 

 

Try

Switch(DataCardValue18.Selected.Value,"Approved",RGBA(127, 178, 57, 1),"Rejected",RGBA( 255, 0, 0, 1 ),RGBA(255, 140, 0, 1))

 

Also add a label on screen and set its Text property to DataCardValue18.Selected.Value to ensure it is returning the correct value.

 

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

Thanks,
Reza Dorrani, MVP
YouTube
Twitter

 

 

@RezaDorrani 

 

Thanks for that.  The Light green words (rejected etc) are a label showing the values, so already going that.  Made you change but still does the same.  Also, as before once i select a rejected item, they all go red,  select an approved one, they all change to green. ????

Hi,

 

Two reasons I can think of for this:

 

One -

Do you need to use a dropdown for those items? Are you going to be changing its value on this same screen?

If its from the same list then just use ThisItem.Status.Value in a label rather than a dropdown/combobox

 

Otherwise:

Two -

When using a gallery, you need to reference an item within a row rather than the control itself if you want to defer to each row's value:

 

Switch(
       ThisItem.Status,
       "Approved", RGBA(127, 178, 57, 1),
       "Rejected", RGBA( 255, 0, 0, 1 ),
       RGBA(255, 140, 0, 1)
)

 

If this is a choice column, then we need to use the .value :

 

Switch(
       ThisItem.Status.Value,
       "Approved", RGBA(127, 178, 57, 1),
       "Rejected", RGBA( 255, 0, 0, 1 ),
       RGBA(255, 140, 0, 1)
)

 

Hope this helps in some way, I'm not certain its the answer but its all I could think of apart from what Reza already covered,

 

Cheers,

Sanho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


@iAm_ManCat 

 

So attached is a grab of my App -  I have created a label that points to ThisItem.Status.Value.  This shows the correct value against each item - no issues.  I changed the Fill value as you suggested (as this is a choice column in my Sharepoint List - but it wont need to be edited here) - then i get a black screen and a message basically stating unable to use ThisItem.Status.Value in the formula (as per second attachment).??

I just tested and confirmed on my end that it only changes once selected using the background referencing the label and that using ThisItem. no longer works for rows... very interesting!

 

Ok, so workaround for this would be to create a label in the background (note its layered position in the gallery on the left), and then have it's fill based on that same formula - tested this and it works:

image.png

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Taylope1
Helper II
Helper II

All working now. Layering worked a treat.  Many Thanks

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

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.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

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