cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

How to determine a control via formula

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User III
Dual Super User III

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!

View solution in original post

6 REPLIES 6
Highlighted
Dual Super User III
Dual Super User III

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!
Highlighted

@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?

Dual Super User III
Dual Super User III

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!

View solution in original post

Highlighted

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"?

Highlighted
Dual Super User III
Dual Super User III

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!
Highlighted

@yashag2255: ok, thanks for your answers.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (8,072)