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 the color of a ...
Power Apps
Answered

Change the color of a rectangle present in a gallery after a patch()

(0) ShareShare
ReportReport
Posted on by

Hi there, 

 

I have a gallery that contains multiple zones. In each zone, there is a gray rectangle.

Is it possible to change the color of the gray rectangle at the top after using the patch() function, without changing the color of the other rectangle at the bottom?

 

ArnaudH_0-1678436344203.png

 

Thank you for your help

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,779 Most Valuable Professional on at

    Hi @ArnaudH ,

    You need to patch a value to the record that you can then test for being present and the set the TemplateFill of the gallery accordingly. So for instance, if you changed a field called Status to Completed and wanted all completed fields to have a Green background, the TemplateFill of the Gallery would be

    If(
     ThisItem.Status = "Completed",
     Color.Green,
     Color.Grey
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

     

  • ArnaudH Profile Picture
    on at

    Thank you for the quick response.

    I had already tried this solution but the problem is as follows: The information displayed in the gallery comes from a SharePoint list 'A', and the Patch() function writes to a SharePoint list 'B'. How is it possible to display data from two different sources in the same gallery?

  • WarrenBelz Profile Picture
    155,779 Most Valuable Professional on at

    @ArnaudH ,

    This is going to be more complex if at all possible. You are going to need a field in List A "linked" to the record in List B by a common value field and if you look it up for the changed value in List B, it is the only record in List A that will reflect the change (or more than one record in the gallery will turn green)

  • ArnaudH Profile Picture
    on at

    I don't quite understand the solution, do I need to import a value from List B to List A during the patch()?

    It's also possible that multiple values in List B are the same. How do you handle these cases?

  • Verified answer
    WarrenBelz Profile Picture
    155,779 Most Valuable Professional on at

    @ArnaudH ,

    I cannot see your data, so am only guessing here - as an example if you had the field LinkA in List A and LinkB in List B and they had the same value (a "key" field if you like) and the changed field was (to use my previous example) is called Status. If there was only one record in List B matching the record you want to colour in List A, then this is easy

    If(
     LookUp(
     'List B'
     LinkB = ThisItem.LinkA
     ).Status = "Completed",
     Color.Green,
     Color.Grey
    )

    If there are multiple matches in list A to the changed item in List B, then all those items in the gallery will turn green. There has to be a one-to-one relationship for this to work.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • ArnaudH Profile Picture
    on at

    Thank you for the response, I see the logic!

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 477

#2
WarrenBelz Profile Picture

WarrenBelz 341 Most Valuable Professional

#3
11manish Profile Picture

11manish 317

Last 30 days Overall leaderboard