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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on June 15, 2022 at 8am PDT.

PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

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