How to update color change of TemplateFill in a Gallery in PowerApps?

917 views Asked by At

I have 2 screens and DataSource is Excel Table. Screen 1 contains Gallery of Systems, and the TemplateFill property of Gallery is set to below code.Below code is filling System tile according to their previous status. Now, in Screen 2 I have signup form where enduser can select the current status of the instrument using drop down. I would like to update Screen1 System tiles based on last "Current Status" submitted by the enduser.Additionally, I have included the screenshots of before and after excel table update.

Not sure how to proceed with OnSelect Property of Submit button.

  If(Thisitem."Previous Status"="Available",RGBA(54,176,75,100),If(Thisitem."Previous Status"="Out of Service",RGBA(255,0,0,100),RGBA(255,191,0,100))

Before Submission (Default Excel Table)

enter image description here

After Submission by End User

enter image description here

1

There are 1 answers

1
SeaDude On

First off, looks like you have an unnecessary nested If(.

Try:

If(
    Thisitem."Previous Status"="Available",
    RGBA(54,176,75,100),
    Thisitem."Previous Status"="Out of Service",
    RGBA(255,0,0,100),
    RGBA(255,191,0,100)
)

Secondly, if you are saying: "I would like to update Screen1 System tiles based on last "Current Status" submitted by the enduser.", it seems to me that you'd substitute "Previous Status" above with "Current Status".

As an aside, if you eliminate " " in your column names, you can avoid double quotes in your code. Consider using PreviousStates or Previous_States.