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 / Filling a square based...
Power Apps
Answered

Filling a square based on a record from Excel

(0) ShareShare
ReportReport
Posted on by 17

Hi, I was looking for a solution on the forum but I couldn't find it. It needs a square that is not in the gallery to be colored based on the record from excel. The data to excel is sent using buttons and the patch function. In the excel file, I have two columns, the first date and the second status. Based on the status column, I want it to fill the square for a given color. For example, x = Color.Green, Y = Color.Blue. Thank you for contributing

Categories:
I have the same question (0)
  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    HI @PatrykPlaska , Could you elaborate more with some screenshots please?

     

    Thanks,

    ANB

  • PatrykPlaska Profile Picture
    17 on at

    Hi @ANB , there are screens of power apps and excel. The square with arrow next to it is not in gallery.  
    Screen1.PNG

    excel.PNG

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    Hi @PatrykPlaska Your code for Fill property of square which is in gallery will be this:

     

     

    Switch(ThisItem.Status, 
    "No accidents",
    Color.Green,
    "Near misses",
    Color.Blue,
    "Non LTI",
    Color.Yellow,
    "LTI",
    Color.Red,
    "Day Off",
    Color.Black)

     

    For the square which is not in gallery and depending upon the selection in gallery, the Fill property will be 

     

    Switch(Gallery.Selected.Status, 
    "No accidents",
    Color.Green,
    "Near misses",
    Color.Blue,
    "Non LTI",
    Color.Yellow,
    "LTI",
    Color.Red,
    "Day Off",
    Color.Black)

     

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

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

    Thanks,
    ANB


  • PatrykPlaska Profile Picture
    17 on at

    It dosent work. There is error about ThisItem.Status "The name is invalid. 'ThisItem' was not recognized." And i had to change "," to ";" becasue i dont know why in polish version of powerapps it had to be like this. 

    ThisItemError.PNG

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    @PatrykPlaska Status is Choice column? Also are you are adding the above code for Fill property of square which is in gallery or out side the gallery?

    I have also edited previous response.

    Thanks,

    ANB

  • PatrykPlaska Profile Picture
    17 on at

    @ANB This is a Value Column, and im adding the code to squre that is out of gallery. I tried both codes, the 2nd one is giving no errors but it does not change the color of the square.

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    HI @PatrykPlaska , The 2nd code will work when you select any record in gallery. Could you share screenshot of 2nd code.

     

    Thanks,

    ANB

  • PatrykPlaska Profile Picture
    17 on at

    Hi @ANB , there is a screenshot of 2nd code. 

    Ss.png

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    @PatrykPlaska What happen when you try to select different records from gallery? Also Status column in your excel is of choice type? I mean you choose from dropdown in excel?

     

    Thanks,

    ANB

  • PatrykPlaska Profile Picture
    17 on at

    @ANB If i select diffrent record from a Status column nothing happend. Andhow can I check what kind of column it is, because I think it's a value column that pops in the record set by the button using the patch function.

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard