cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
max81
Level: Powered On

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
Super User
Super User

Re: How to determine a control via formula

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
Super User
Super User

Re: How to determine a control via formula

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!
max81
Level: Powered On

Re: How to determine a control via formula

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

Super User
Super User

Re: How to determine a control via formula

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

max81
Level: Powered On

Re: How to determine a control via formula

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

Super User
Super User

Re: How to determine a control via formula

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!
max81
Level: Powered On

Re: How to determine a control via formula

@yashag2255: ok, thanks for your answers.

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 72 members 2,988 guests
Recent signins:
Please welcome our newest community members: