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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Component tab menu var...
Power Apps
Answered

Component tab menu variable issue expected a text or number

(0) ShareShare
ReportReport
Posted on by

I have a component named cmptabnavigaton that I created to manage a tab like navigation.

The component has the following custom properties:

TabNav Table = Table({Id:1, Label:"Tab 1"}, {ID:2,Label:"Tab 2"})

TabNavVar Output = varTabSelected.ID

 

The component includes a gallery where I have a button to serve as the tabs.

The gallery items = cmptabnavigation.tabnav

gallery button Onselect = Set(varTabSelected,cmptabnavigation.TabNav.ID)

 

Error message for TabNavVar is Expected text value.

 

Expected result is I am able to pass the TabNavVar Output into my app which should be a number. Then within the visibility settings  I will be able to control which fields on the form show based on the tab the user is on.

 

I am trying to essentially replicate this but in a component manner for re-use and tons of screens.

https://www.youtube.com/watch?v=KjUJZr5Vn_Y&t=489s can start at 4:40

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mjackson122 

    How did you define the TabNavVar property on your component?

    Also, you should avoid using variables in components as they do not function the way that one might think and they are then global to other uses.  That video apparently is using a bad practice for a component.

     

    The TabNavVar property should be set to: yourGallery.Selected.ID

     

    I hope this is helpful for you.

  • mjackson122 Profile Picture
    on at

    TabNavVar is a Output = varTabSelected.ID.

     

    Your update worked to remove the error on the component side. However on the screen side when I attempt to set a fields visibility to cmptabnavigation.TabNavVar=1 I receive the error message incompatible types for comparison. So I changed the type for TabNavVar to number. Then I was able to get the error message to go away. However, when I try to control a field where TabNavVar=2 The field just disappears. I did a label trick to see what application was reading and when TabNavVar=1 the label returns 1 when TabNavVar=2 the label returns false...What am I missing?

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mjackson122 

    Setting a formula such as TabNavVar = 1 will not return a 1, it will either be true or false. 

    Instead set your text property on the text label to: cmptabnavigation.TabNavVar

    What does that show and what are some specific formulas that you are using?

     

  • mjackson122 Profile Picture
    on at

    cmptabnavigation.TabNavVar in the label shows 1

    I am trying to pull the id number from my table in the component where each id corresponds to a label in my menu. For the fields where I am trying to hide based on which tab you are on (ID) I am using 

    cmptabnavigaton.TabNavVar=1 then some fields will have cmptabnavigaton.TabNavVar=2

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

    @mjackson122 

    Yes, I am perfectly clear with what you are doing.  I do this all the time.  My components are vastly different, but the concept is the same.

     

    So, you are stating though that the label shows 1.  Does it change when you select a different tab in the component?

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#2
Kalathiya Profile Picture

Kalathiya 361

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 339 Super User 2025 Season 2

Last 30 days Overall leaderboard