cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MNoel
New Member

Component name as text

Hi there, 

              Do anyone know how to get a component name and use it as a text value? 

 

Backstory: 

     I have a component called "Q" with a label object called "QText". I want "QText.Text" property to have the valve of Q component name (QText.Text = "Q" ). I don't see an option to get the component name value. 

 

Any help or hints would be gratefully appreciated. Thank you. 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@MNoel 

No, you cannot refer to controls by name, nor get them by name, unless they have a property that exposes a defined value.

You could create an Output text property on your component called Name and then set it to "Q" in the component.

Then you could refer to your component in the app and the .Name property.

That would be about the only option.  But, in the component, you will not be able to get its name.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
RandyHayes
Super User
Super User

@MNoel 

You cannot reference component names like that.  PowerApps is declarative, so you need to reference a property of the component you have created and then declare that value in the property.

Perhaps if you elaborate more on what you are trying to accomplish, this can be described a bit more.

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks for the quick reply. All I am simply trying to do is get the component name as a text value. Is there a way to do that? 

RandyHayes
Super User
Super User

@MNoel 

No, you cannot refer to controls by name, nor get them by name, unless they have a property that exposes a defined value.

You could create an Output text property on your component called Name and then set it to "Q" in the component.

Then you could refer to your component in the app and the .Name property.

That would be about the only option.  But, in the component, you will not be able to get its name.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

That's unfortunate 😥 

RandyHayes
Super User
Super User

@MNoel 

Well, I am not sure of your purpose for it, but in general, having a component, or any control name, as text is not helpful for anything in PowerApps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

I simply wanted to dynamically update a text based on the component name.

Example: Component Q -> With label object Text would have text value of "Q" 

Q_1 text value would be "Q_1" ... all the way to "Q_100" etc.. 

RandyHayes
Super User
Super User

@MNoel 

Yeah, not entirely sure if you are wanting this from the inside of the component or exposed from the component.  But in general, the component only has one name to it, so I believe you are referring to the name that is assigned once it is added to an app screen...and from that perspective, there is not a way to get that name.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Power Apps Ideas

Changes to Ideas Coming

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (1,836)