cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

How to put code in a component ?

Hi,

 

I have created this component with some buttons in it :

MenuLateral.png

 

I have put this kind of code in the buttons : 

Navigate([@EditScreen1])
 
It doesn't seems to work, and the code I put generally in my components never work, this begs the question :
 
can we insert code in components or are they simply here for decorative purpose ?
 
Thanks for helping,
4 REPLIES 4
Highlighted
Super User III
Super User III

@Anonymous 

The formulas you use in your component are specific to your component, not to your app.

You cannot reference items within your app in your component.  

This is all because components are designed to be reusable in any app.  So, if you put a screen name in your component formulas to navigate to, that would be specific in your app and thus the component would not be reusable in another app as it would most likely not have that same screen.

 

In order to do this in an app, you need to set properties on the component with information from your app.

So, for example, if you wanted to have screen names to navigate to, you could supply a table of names to a custom property on your component - like ScreenIndexTable for example.

 

Set ScreenIndexTable to :  Table({ID:1, screen: screen1}, {ID:2, screen: screen2}) etc.

Then in your component, you can reference that table and navigate from it.

Example, if you had something displaying that related to ID 1, you could set the OnSelect of it 

Navigate(Lookup(myComponent.ScreenIndexTable, ID=1))

 

This is a VERY crude example which is simply to demonstrate that you need to provide app specific information to your component as your component cannot access anything specific about your app.

 

I hope this is helpful for you.

 

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted
Super User III
Super User III

@Anonymous 

I think watching a video would be the most helpful thing here.   This is one by @BrianKnight shows how to add Navigate 'code' to the component.

 

Link to Youtube: 

https://powerusers.microsoft.com/t5/Webinars-and-Video-Gallery/Creating-a-PowerApps-Menu-Components/td-p/358296

 

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

Highlighted
Anonymous
Not applicable

Hi @mdevaney @RandyHayes 

 

Thanks for answering, I have this problem when I try to create a custom property in my component, nothing shows up in the parameters, and it's the same thing if I want to edit it. I can't remove the custom property I created also.

 

Here is what it shows when I create a custom property :

customProperty.png

Highlighted

@Anonymous 

Hmm...you're now the second person that I heard of this.  See this post.

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

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

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

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,995)