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.
Solved! Go to Solution.
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.
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.
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?
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.
That's unfortunate 😥
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.
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..
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.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
User | Count |
---|---|
185 | |
53 | |
50 | |
36 | |
34 |
User | Count |
---|---|
270 | |
91 | |
82 | |
76 | |
75 |