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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to determine a con...
Power Apps
Answered

How to determine a control via formula

(0) ShareShare
ReportReport
Posted on by 860

Hello together,

 

is it possible to determine a control via formula?

 

Example:

I have 20 labels: label1, label2, ...

I also have 1 textfield and a button.

In the textfield, I can enter a number between 1 and 20.

By clicking on the button, I want to change the color of the label with the number I entered in the textfield.

So the OnSelect function should be something like this:

 

label & [textfield.text].fill = red

 

In fact: if I have entered in the textfield a "5", label5 should be filled red.

 

How can I do this?

 

Thanks and best regards,

Max

 

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @max81 

     

    You can achieve this by setting the configuration as:
     
    Label1 -> Fill -> If(SelectedLabel = "1",Red,RGBA(0, 0, 0, 0))
    Label2 -> Fill -> If(SelectedLabel = "2",Red,RGBA(0, 0, 0, 0))
    Label3 -> Fill -> If(SelectedLabel = "3",Red,RGBA(0, 0, 0, 0))
    ...
    Label20 -> Fill -> If(SelectedLabel = "20",Red,RGBA(0, 0, 0, 0))
     
    Button -> OnSelect -> Set(SelectedLabel, TextInput1.Text)
     
    Here, TextInput1 is the name of text input control.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • Mx81 Profile Picture
    860 on at

    @yashag2255thanks for your replay.

     

    Of course that would be possible, but I would like to have a solution where I don't need to adjust for every control the fill function.

    It was only an example for a more complex problem and therefore I need a possibility to change a setting of a control that is determined by a formula.

     

    Do you know what I mean?

  • Verified answer
    yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hey @max81 

     

    Yes, I understand the scenario, but setting up some control's property based on a button click without using the variables is not doable. You need to manually set up the values in all the controls. I agree with the fact that it should be added to the functionalities and if you think it should, please raise an idea or upvote if exist already on: https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • Mx81 Profile Picture
    860 on at

    Is it possible to create a variable via a formula?

     

    For example:

    Set(myVariable & TextInput1.Text; "Red")

     

    So I get for instance a virable myVariable10 with value "Red"?

  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @max81 

     

    No, the naming of variable is not possible this way. Even if you create such a condition where there will be different variable for all the labels, but for that also you have to update each label individually.
     
    Hope this Helps!
     
    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
  • Mx81 Profile Picture
    860 on at

    @yashag2255: ok, thanks for your answers.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 355 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard