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

Function Set () in Components

Hi Guys,

I'm not able to use variables with the Set () function that were assigned within the components that are inserted in some screens. Does the Set () function not work within components ??

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Hi @Danilo-ES-BR ,

Could you please share a bit more about your scenario?

Do you want to reference the variable set within your Component within your app screen (outside the Component)?

 

Currently, within PowerApps, you could set up a global variable within the custom component. But the variable is scoped to component itself rather than whole canvas app.

Please check the following known limits with custom component in PowerApps:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-component#known-limitations

 

If you want to reference the global variable set up inside your custom component within your app screen (outside the Component), you consider add a Output property within your custom component, then bind the Output property with the global variable within your custom component.

After that, within your app screen, you could reference the global variable through the Output property of the custom component. I have made a test on my side, please take a try with the following workaround:

2.JPG

 

3.JPG

 

4.JPG

After that, you could reference the global variable within your app screen through the Component Output property. Within your app screen, you could use the following formula to reference the Output property of the custom component:

CustomComponentControlName.OutputProperty

 

More details about the custom properties in custom component, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-component#custom-properties

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Super User III
Super User III

@Danilo-ES-BR 
You can use variables inside components.  But those SET variables should only be used inside the component and not referenced outside the component.  Create a new output property if you need the component to communicate something to the outside world.

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

Community Support
Community Support

Hi @Danilo-ES-BR ,

Could you please share a bit more about your scenario?

Do you want to reference the variable set within your Component within your app screen (outside the Component)?

 

Currently, within PowerApps, you could set up a global variable within the custom component. But the variable is scoped to component itself rather than whole canvas app.

Please check the following known limits with custom component in PowerApps:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-component#known-limitations

 

If you want to reference the global variable set up inside your custom component within your app screen (outside the Component), you consider add a Output property within your custom component, then bind the Output property with the global variable within your custom component.

After that, within your app screen, you could reference the global variable through the Output property of the custom component. I have made a test on my side, please take a try with the following workaround:

2.JPG

 

3.JPG

 

4.JPG

After that, you could reference the global variable within your app screen through the Component Output property. Within your app screen, you could use the following formula to reference the Output property of the custom component:

CustomComponentControlName.OutputProperty

 

More details about the custom properties in custom component, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/create-component#custom-properties

 

Best regards, 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (11,531)