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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change the color of a ...
Power Apps
Unanswered

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
    153,034 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
    153,034 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
    153,034 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard