I have Gallery1, in which there is a 'Trash' icon that allows the user to delete that item in the gallery with -
Remove(Subscriber_Address_List,ThisItem)
There is a desire to provide a message that asks the user if they want to delete this item, to minimize unintended deletes.
To that end, I have added a Label1 (with the message), and a 'Yes' and 'No' button.
The 'Yes' button now has the Remove(Subscriber_Address_List,ThisItem) formula, as well as Set(varDeleteControlsVisible, false).
The 'Trash' icon now has Set(varDeleteControlsVisible, true).
The 'No' button has Set(varDeleteControlsVisible, false).
My issue, when the 'Trash' icon is pressed the other controls appears in each item of Gallery1. Is there a formula I can use that when the 'Trash' icon is pressed the other control appear only in the item in which the 'Trash' icon was pressed and nowhere else?
I understand now.
Userd UpdateContext({selectedItem:161616161}) and it worked.
Thank you!
What is the type of Data(ID)?
As I mentioned in the above, If ID is not a text but a number, set a random integer that is not expected to come out from your data instead
"Incompatible types for comparison. These types can't be compared. Error, Error."
I only had the formula to the 'Yes' button, as a test.
what is the error message?
When I put UpdateContext({selectedItem:" "}) in the 'OnSelect' of the 'Yes' button I get an error in and the other two controls.
UpdateContext({selectedItem:"NOTHING_SELECTED"}); //OnSelect of yes and no button
Any value would work unless it is duplicated with keys in the list. An empty string ("") or meaningless "dkiwjidsdskewdwwew" would also work. That is like setting the visible value to false again as if no item has been selected yet.
If ID is not a text but a number, set a random integer that is not expected to come out from your data instead
Kirkby
Yes, sir.
That's the ticket!
One last; The 'Trash' icon has the following in the 'OnSelect' to control the visibility of those delete controls.
I am now only seeing the controls in the specific item in which the 'Trash' icon is pressed.
What code should be in the 'Yes' and 'No' buttons to hide them once the are clicked, returning the Gallery to its default state where delete buttons/label are hidden?
varDeleteControlIsVisible is reflected uniformly across all items, so all delete controls will be displayed. The Visible property should be changed to True or False for each individual item at every single time by action of an user, so please enter "selectedItem = ThisItem.ID" instead of using the variable.
The result of logical expression, "selectedItem = ThisItem.ID" (Don't miss "selectedItem=", and Not ThisItem.Key....) decides Visible value to display the control.
Additionally, since the Delete control includes two buttons, it is cumbersome to manage the Visible property for each. Placing the Delete Control (with two buttons) in a Container "as a parent" and activating the Visible property of the container with selectedItem = ThisItem.ID would be more convenient.
Got it.
Made that 'KeyOfTheItem' change to 'ID'.
That error went away.
However, my 'Delete' controls (Label1, 'Yes' and 'No' buttons) are still appearing on each line.
The below represents what the Visible for each has in it.
If I change the Visible to ThisItem.KeyOfTheItem I get errors. I'm sure this is not correct. What should the visible of each?
WarrenBelz
791
Most Valuable Professional
MS.Ragavendar
410
Super User 2025 Season 2
mmbr1606
275
Super User 2025 Season 2