cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AppsBuilder310
Frequent Visitor

Fill Property is Indirect Function?

Hello!

 

I am designing an app that will be used across multiple sub-businesses so instead of building each business their own app/color scheme, I'd like to set the colors as variables within the app that will reference a variable.

 

Ex: 

 - At the app login, the user selects their company  (varCompany = CompanyA) and navigates to a menu

 - I have a box on a settings screen set as "Color1_CompanyA" another box as "Color1_CompanyB"....etc.

 - I want all the colors to be dynamic based on those setting screen colors

 

Question: I want to set the fill color for the box on the the menu as Color1_CompanyA.fill HOWEVER I need the "CompanyA" piece to be dynamic so I'm thinking it needs some sort of indirect coding?  Something like the fill property is Color1_varCompany.fill but how do I use a variable inside a fill property name? 

 

Is this possible in Power Apps?

 

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User III
Super User III

@AppsBuilder310 

You can certainly do all of this in PowerApps.

If you are indirectly referencing another control to derive your fill color, then you can use a formula such as this on the Fill property:

Switch(varCompany, "CompanyA", Color1_CompanyA.Fill, "CompanyB", Color1_CompanyB.Fill)

 

However, it would be less work for you if you had a single box in your app (companyColor) and set the Fill of that to:

Switch(varCompany, "CompanyA", Red, "CompanyB", Blue)

(just using Red and Blue as an example)

 

Then in the rest of your app, set the Fill properties of the controls you want to be dynamic to : companyColor.Fill

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

2 REPLIES 2
RandyHayes
Super User III
Super User III

@AppsBuilder310 

You can certainly do all of this in PowerApps.

If you are indirectly referencing another control to derive your fill color, then you can use a formula such as this on the Fill property:

Switch(varCompany, "CompanyA", Color1_CompanyA.Fill, "CompanyB", Color1_CompanyB.Fill)

 

However, it would be less work for you if you had a single box in your app (companyColor) and set the Fill of that to:

Switch(varCompany, "CompanyA", Red, "CompanyB", Blue)

(just using Red and Blue as an example)

 

Then in the rest of your app, set the Fill properties of the controls you want to be dynamic to : companyColor.Fill

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

AppsBuilder310
Frequent Visitor

This is perfect!  Just tried the second solution out and it works great.  Thanks for your help!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (2,571)