I have a gallery with a complete button. When someone clicks on the complete button, I want the button to turn to blue. Right now,
Galleryname: gal_Assignment
button name: btn_Completed
I have set variable on select: UpdateContext({ toggleValue: !toggleValue })
Then I changed the fill for the button to: If(toggleValue, Color.Blue, Color.Green)
When I run the app and click on the button, all completed buttons in the gallery turn blue. that is not what I want. I only want thisitem.completed to turn blue. Let me know if you think a screen shot would help
How do I change this to make that work?
Here is how those examples work.
///A switch checks the value of something, and when a condition is met returns that action
Switch(
//Check for the value of this gallery item in a collection
CountRows(Filter(examplebutton, Value=ThisItem.Value)),
///If it is not there, add it
0, Collect(examplebutton,ThisItem.Value),
///If it is, remove it (this allows them to unchange the color of the button
///and can be removed if you don't want them to be able to
RemoveIf(examplebutton,Value=ThisItem.Value))
Switch(
///checks if this item was collected (has been pressed)
CountRows(Filter(examplebutton, Value=ThisItem.Value)),
///If not color button pink
0, Color.Pink,
///If this is not true, then the adverse is which means it has been pressed and we color it blue
Color.Blue)
It's self contained in the app itself, so if they close the app and reopen it later down the road the buttons will allr eturn to their default color of pink.
If you want to PERMANENTLY for rest time change button colors when that item has been selected you will need to swap that collect action, into a patch of that item onto a sharepoint list that has a single text column that can store this value over time.
could you explain what your code is doing? I dont understand it. sorry 😞
I'm am such a beginner to power apps. This looks really cool, but I don't know what it's doing. Currently for the onselect property, I'm doing a patch to the sql database (see below patch):.
The completed button should patch to the database and change colors to indicate that it has been patched. I probably haven't thought this thru very good because, what if they need to change something and then click the button again. The user wants a way to flag the user that they have actually clicked the button, but they also want to be able to click the button multiple times if changes need to occur. How would you do this? There is a field in the database for completed. I was not sure what you value = thisitem.value should be referring to.
Patch(CaseAssignment,ThisItem,{Note:txt_Note.Text},
{needpatdemos:chk_NeedPatientDemos.Value},
{newfacility:chk_NewFaciliy.Value},
{newneph:chk_NewNeph.Value},
{whichneph:chk_WhichNeph.Value},
{needneph:chk_NeedNeph.Value},
{needinsurance:chk_NeedInsurance.Value},
{oncallpath:chk_Oncallpath.Value},
{othercs:chk_OtherCS.Value},
{otherpath:chk_OtherPATH.Value},
{surgicalquestion:chk_SurgicalQuestion.Value})
Here's one way.
I made a gallery, and made it's items [1,2,3,4,5,6,7,8]
In this gallery I placed a button with the OnSelect of
Switch(
CountRows(Filter(examplebutton, Value=ThisItem.Value)),
0, Collect(examplebutton,ThisItem.Value),
RemoveIf(examplebutton,Value=ThisItem.Value))
I also set its fill value to
Switch(CountRows(Filter(examplebutton, Value=ThisItem.Value)),
0, Color.Pink,
Color.Blue)
This will change button color, as clicked, for each gallery row individually, and also let you click a second time to unclick it.
WarrenBelz
146,788
Most Valuable Professional
RandyHayes
76,287
Super User 2024 Season 1
Pstork1
66,093
Most Valuable Professional