We have a Component library which includes a firmColors function returns a color (enum) based on a text parameter (e.g. "Royal Blue"). This is performing well. We are now building a component which display a gallery of data. There is a rectangle behind all of the other controls whose Fill color is based on a field value.
My question is: can this new component make use of our firmColor component so we do not need to duplicate the color table?
I suspect our long term solution will be to place this table in the DataVerse, I am not quite at that level of craftpersonship.
Solved! Go to Solution.
Gotcha on the custom color names.
Yes, a component is designed to be a portable object that can be used in any app. So creating a dependency on a datasource, for example, breaks that portability. It says that, any app that hosts that component must have a connection to the datasource. That is a dependency.
You can, create a component to have that dependency. PowerApps does allow it to happen, but this is a retired feature that allows it. That feature has been replaced with the Access app scope property on the component.
But a lot of that changes quite often as these features are somewhat experimental at this point. In fact, I'm not even currently seeing that property any more.
But still, dependencies in the components is generally not a good way to go.
You cannot reference another component in a component. They are currently autonomous.
Also I would avoid data interactions with your components directly to a datasource. This creates a reliance on the host app which breaks the concept of a component.
Also, in terms of your color component - are you aware that you can already convert a color in text into a color? - ex: ColorValue("RoyalBlue") will return the RoyalBlue color.
I hope this is helpful for you.
Wow, thank you for the prompt reply.
WRT the color value, the colors are actually custom, not the OOTB choices. For examples the text label may be something like "Retail Primary", "Retail Shadow", "Government Primary", International Primary", etc. I was doubtful components could refer to each other, the dependencies and relationships could easily.
I was thinking using a table in the DataVerse separate the business logic layer from the data layer and could be shared by components, solutions and apps within an environment. But if I interpret you reply correctly, the data connection is through the host app and not the component.
Gotcha on the custom color names.
Yes, a component is designed to be a portable object that can be used in any app. So creating a dependency on a datasource, for example, breaks that portability. It says that, any app that hosts that component must have a connection to the datasource. That is a dependency.
You can, create a component to have that dependency. PowerApps does allow it to happen, but this is a retired feature that allows it. That feature has been replaced with the Access app scope property on the component.
But a lot of that changes quite often as these features are somewhat experimental at this point. In fact, I'm not even currently seeing that property any more.
But still, dependencies in the components is generally not a good way to go.
You cannot reference another component in a component.
in your color component you have already convert a color in text
into a color? - ex: ColorValue("RoyalBlue") will return the RoyalBlue color.
User | Count |
---|---|
261 | |
116 | |
99 | |
48 | |
41 |