Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Gallery Tabs - Show or Hide Tabs based on Field Value

(0) ShareShare
ReportReport
Posted on by 948
I have a list of Tabs using a Gallery and I would like to hide some of those tabs if a field value equals as certain value.  I want to hide the Subcontracting tabs based on a field in the form.  
 
Items = 
Table(
    {
        ID: 1,
        Label: "General Info"
    },
    {
        ID: 2,
        Label: "Contract Info"
    },
    {
        ID: 3,
        Label: "Prime Info"
    },
    {
        ID: 4,
        Label: "Gov't Info"
    },
    {
        ID: 5,
        Label: "T&C/Clause Info"
    },
    {
        ID: 6,
        Label: "Deliverable Info"
    },
    {
        ID: 7,
        Label: "Employee Info"
    },
    {
        ID: 8,
        Label: "Security Info"
    },
    {
        ID: 9,
        Label: "Billing/Invoices Info"
    },
    {
        ID: 10,
        Label: "Subcontracting Info"
    },
    {
        ID: 11,
        Label: "Subcontracting Details"
    },
    {
        ID: 12,
        Label: "Notes/Attachments"
    },
    {
        ID: 13,
        Label: "Signatures"
    }
)
Categories:
  • Suggested answer
    KeithAtherton Profile Picture
    3,690 Most Valuable Professional on at
    Gallery Tabs - Show or Hide Tabs based on Field Value
    That code looks good. Did you also set the gallery item control (I'm guessing button) Visible property to ThisItem.Visible?
  • kmw1130 Profile Picture
    948 on at
    Gallery Tabs - Show or Hide Tabs based on Field Value
    @KeithAtherton,
    I added your suggestion on the Items:
    But it didn't seem to change when Sub wasn't selected.
     
    Did I not add it correctly?
  • RyanAutomates Profile Picture
    134 on at
    Gallery Tabs - Show or Hide Tabs based on Field Value
    Hello,
     
    I haven't used a table inside a gallery before, but it sounds like you're almost trying to make a sort of dynamic menu? I think there might be a few approaches to what you would like to do:
     
    1) In the visible property of each control in your row, you can put an If condition for each row, or use a switch statement:
     
         If(ThisItem.ID = 3 && !examplebooleanfieldonyourform, false, true),
         If(ThisItem.ID = 4 && !anotherexamplebooleanfieldonyourform, false, true)
         
         Switch(
              True,
              Condition1, Result1,
              Condition2, Result2,
              Condition3, Result3,
              DefaultResult
    )
     
    This might not produce the UI requirements you are looking for however, as it may leave you with a row of empty space.
     
     
    2) The answer that's probably best is to dynamically filter out any row in your table by using a "Filter" operator with conditions on the end:
     
         Filter(
              Table(
                        { ID: 1, Label: "General Info" },
                        { ID: 2, Label: "Contract Info" },
                        { ID: 3, Label: "Prime Info" },
                        { ID: 4, Label: "Gov't Info" },
                        { ID: 5, Label: "T&C/Clause Info" },
                        { ID: 6, Label: "Deliverable Info" },
                        { ID: 7, Label: "Employee Info" },
                        { ID: 8, Label: "Security Info" },
                        { ID: 9, Label: "Billing/Invoices Info" },
                        { ID: 10, Label: "Subcontracting Info" },
                        { ID: 11, Label: "Subcontracting Details" },
                        { ID: 12, Label: "Notes/Attachments" },
                        { ID: 13, Label: "Signatures" }
              ),
              !(ID = 3 && !examplebooleanfieldonyourform) // Condition to exclude "Prime Info" row if examplebooleanfieldonyourform is false
    )
     
    I haven't tried this myself with a table, but I think it might make the options you don't want displayed to disappear.
     
     
    3) You could put containers inside the gallery for each row to dynamically toggle visibility of each container based on conditions. This would give you more granular control over every aspect but would require writing or copy pasting lots more Power Fx.
     
     
    Hope this helps! :)
  • Verified answer
    KeithAtherton Profile Picture
    3,690 Most Valuable Professional on at
    Gallery Tabs - Show or Hide Tabs based on Field Value
    Hey. This approach looks good - you could add another field called "Visible" which checks the condition of interest (in my case, txtMyField.Text = "TEST") then use that field value for the gallery item button visible property:
    Table(
        {
            ID: 1,
            Label: "General Info",
            Visible:txtMyField.Text = "TEST"
        },
    // etc
     

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 479 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 197

#3
stampcoin Profile Picture

stampcoin 166

Overall leaderboard