cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
adoyle5
Helper I
Helper I

Can you build a Property Value based on other input?

I am hoping to have a pop up that will appear when someone clicks on a "help icon" beside buttons.

 

However, there are seven help buttons. I don't want to have to create 7 seperate popups (A rectangle with text boxes, that are only visible when a variable is set). This would get crowded fast, as well as surely impact performance.

 

What I am hoping to do is something like this:

 

Set(HelpVariable, 1);
Set(TestFont2, "ScoringLabel" & HelpVariable & ".Font")

 

 

Now, this works if I set a Text Property to TestText:

 

Set(HelpVariable, 1);
Set(TestText2, "ScoringLabel" & HelpVariable & ".Text")

 

The text of the label is: ScoringLabel1.Text

But if I set the label's Font property to TestFont, I get the default font. Not the one in ScoringLabel1

 

If I check what is in "TestFont" it shows ScoringLabel1.Text with a Data type: text

image.png

Is the Data type wrong? Can I change it at all to do this?

 

If I can build property values like this, my apps will be amazingly dynamic. 

 

The only other way I can think of doing it, is a nested IF statement, which, again: seems silly.

 

 

Any help is appreciated! 

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@adoyle5 

PowerApps does not allow us to make dynamic references in the way you describe.  Unfortunately, references must be written out.

 

Set(HelpVariable, 1);
Set(TestFont2, 
    Switch(
        HelpVariable,
        1, ScoringLabel1.Font,
        2, ScoringLabel2.Font,
        3, ScoringLabel3.Font,
        4, ScoringLabel4.Font,
        5, ScoringLabel5.Font,
);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

3 REPLIES 3
mdevaney
Super User
Super User

@adoyle5 

PowerApps does not allow us to make dynamic references in the way you describe.  Unfortunately, references must be written out.

 

Set(HelpVariable, 1);
Set(TestFont2, 
    Switch(
        HelpVariable,
        1, ScoringLabel1.Font,
        2, ScoringLabel2.Font,
        3, ScoringLabel3.Font,
        4, ScoringLabel4.Font,
        5, ScoringLabel5.Font,
);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

NaveedMohammad
Regular Visitor

I think you are looking for something like an Eval() function.

But this is not available in PowerApps yet.

 

For your requirement though, can you use something like instead of trying to get the font type of a control?

Set(FontType,Font.'Dancing Script')

The Switch operator helped massively. It does not solve the issue, but it helps me. Thank you!

I managed to get what I needed done, but with a tonne of Switch and IF statements. 

 

I love PowerApps, but I can't help but think it is an unfinished product the more I try to use it.

Helpful resources

Announcements
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.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,507)