web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Table to set variable
Power Apps
Answered

Table to set variable

(0) ShareShare
ReportReport
Posted on by Super User 2024 Season 1

Hi 

I have a gallery table format and i would like when select the button inside each to set is own variables example on my first button New when click to set ResetForm(FormCheckEdit); Set(varFormMode,FormMode.New) and second button to Set(varFormMode,FormMode.Edit) here is the formula table item property of my gallery and screenshot.


 

 

Table(
 {
 ID: 1,
 Label: "New",
 Icon: Icon.Add
 },
 {
 ID: 2,
 Label: "Edit",
 Icon: Icon.Edit
 },
 {
 ID: 3,
 Label: "Save",
 Icon: Icon.Save
 },
 {
 ID: 4,
 Label: "Delete",
 Icon: Icon.Trash
 },
 {
 ID: 5,
 Label: "Cancel",
 Icon: Icon.Cancel
 }
)

 

 

Capture0.PNG

 

Thank you 

 

 

 

 

 

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    155,300 Most Valuable Professional on at

    @Ramole ,

    I am not sure what you want to do on the last few, but this is the syntax for the OnSelect of the gallery.

    Switch(
     ThisItem.Selected.Label,
     "New",
     Set(varFormMode,FormMode.New),
     "Edit",
     Set(varFormMode,FormMode.Edit),
     "Cancel",
     ResetForm(FormCheckEdit),
     "Save"
     SubmitForm(YourFormName),
     "Delete",
     YourDeleteCode
    ) 

     

    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.

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    @WarrenBelz 

     

    Is the code goes the button onselect ?

     

     

  • WarrenBelz Profile Picture
    155,300 Most Valuable Professional on at

    @Ramole ,

    I assume this is a horizontal gallery? Yes - you could put it on the button OnSelect or the gallery OnSelect (or both)

     

    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.

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @WarrenBelz 

     

    It worked but is possible to add like if the form is on New Mode do not show or disable the delete button and edit button

     

    Thanks 

     

     

     

  • Verified answer
    WarrenBelz Profile Picture
    155,300 Most Valuable Professional on at

    @Ramole ,

    On the DisplayMode of the button

    If(
     varFormMode=FormMode.New && 
     (ThisItem.Label="New" || ThisItem.Label = "Delete"),
     DisplayMode.Disabled, 
     DisplayMode.Edit
    )

     

    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.

  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Thank you @WarrenBelz

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 1,045

#2
Valantis Profile Picture

Valantis 675

#3
11manish Profile Picture

11manish 592

Last 30 days Overall leaderboard