cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ShawnJones
New Member

Power App Button Selection History

Does anyone know how I can maintain the Fill, historically, from a button selection for an app that would be put into SharePoint? I have a traffic light that I put on a SharePoint site to show team members support availability.  The issue that I am having is that whenever I refresh Sharepoint all traffic lights go back to the unselected color (gray)

 

I created a traffic light where a user can click the red light, yellow, or green and it will stay at that color, using:

 

Red Light program:

OnSelect = UpdateContext({Red_Light:true,Yellow_Light:false,Green_Light:false})

Fill = If(Red_Light,Red,Gray)

 

Yellow Light:

OnSelect: UpdateContext({Red_Light:false,Yellow_Light:true,Green_Light:false})

Fill: If(Yellow_Light,Yellow,Gray)

 

Green Light: 

OnSelect: UpdateContext({Red_Light:false,Yellow_Light:false,Green_Light:true})

Fill: If(Green_Light,Green,Gray)

 

I made slight changes for each light, and it will turn on whichever light you select and turn off the others. The issue I am having is that whenever you refresh the SharePoint site all the selected lights go back to unselected/gray. So, I was wondering if anyone knows of a way to save the history of the last button click so that the traffic light maintains its last selection in SharePoint. 

 

Sorry to if this is a simple question or if I had a strange/overly complex way to do a traffic light, I am an extreme rookie at Power Apps.

1 REPLY 1
Scott_Parker
Responsive Resident
Responsive Resident

It sounds like you are embedding a Power App in a SharePoint page. If you want the status of the lights to be shared between instances of the App, you must save the data somewhere else. No information is exchanged between different open instances of an App.

 

Since you're already working in SharePoint, create a SharePoint List with a row for each of your users. Create a single choice column called "Color" with options of "Green, Red, Yellow, Grey." This is where you can store your data using the Patch() function from Power Apps.

 

Create a Horizontal gallery in your Power App and create your traffic light within it.

 

Sorry if this was too basic, it sounds like you're asking something very basic.

Helpful resources

Top Solution Authors
Top Kudoed Authors
Users online (4,235)