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 / How to get the name of...
Power Apps
Unanswered

How to get the name of the previous Tab/button a user selected

(0) ShareShare
ReportReport
Posted on by 71

hello!

 

i'm having a hard time figuring out how to do something that i thought would be pretty easy

 

i have a tab list that filters a gallery based on which tab is selected. i need to find a way to get the PREVIOUS tab title that a user clicked on, for example if my tabs are:

Tab1, Tab2, Tab3, Tab4, Tab5

 

if a user is on Tab1 and then clicks on Tab3, i need a variable or a label or something that says "Tab1." 

and if the user then clicks from Tab3 to Tab2, i need it to say "Tab2," etc.

 

i've tried messing around with setting variables in the OnSelect and OnChange of the tab list to no avail.

 

anyone have any ideas?

 

thanks so much in advance!

Categories:
  • Michael E. Gernaey Profile Picture
    53,970 Super User 2026 Season 2 on at

    hi @_ru 

     

    Here is something you can do.

     

    Create a Collection something like this

    Initialize enough items for tabs
    ClearCollect(TabListStatus,
    { TabName: "UseTabText", Status: "Not Selected" }, // here use numbers or words
    { TabName: "UseTabText", Status: "Not Selected" }, // here use numbers or words
    { TabName: "UseTabText", Status: "Not Selected" }, // here use numbers or words
    { TabName: "UseTabText", Status: "Not Selected" }, // here use numbers or words
    { TabName: "UseTabText", Status: "Not Selected" }, // here use numbers or words
    );
    
    Now in the Tab OnSelect, First do this
    UpdateIf(TabListStatus, Status = "Selected", {Status: "Previous" } );
    
    Now in the same OnSelect
    UpdateIf(TabListStatus, TabName = "SendIntheCurrentTabsTextValue", {Status: "Selected" } );
    
    Now you can tell what Tab was previous and depending on what you need to do you can setup a way to Select it etc.
    
    I know you also said that you have different scenarios so might have to think on it more.
    Might need to have a collection / Scenario combo


    If I have helped you, I would really appreciate if you please Mark my answer as Resolved/Answered, and give it a thumbs up, so it can help others

    Cheers

    Thank You
    Michael Gernaey MCT | MCSE | MCP | Self-Contractor| Ex-Microsoft
    https://gernaeysoftware.com
    LinkedIn: https://www.linkedin.com/in/michaelgernaey

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 411 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 338

#3
WarrenBelz Profile Picture

WarrenBelz 256 Most Valuable Professional

Last 30 days Overall leaderboard