cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
brandonkparker
New Member

Single Page App - I am on the struggle bus :)

Hi Everyone,

 

I am on the struggle bus. 

 

I am trying to build a single page app, where the user moves from screen to screen filling out forms and forms hide/appear based on the button clicked. 

 

I am using this post as reference.

 

Solved: Re: Power apps - Show/Hide Button - Power Platform Community (microsoft.com)

 

 

If I set the variable to TRUE, I can run the app and click the button and the form appears. However, if I set it to FALSE, then the form disappears on app run (it should disappear on button press). Basically, I need the form to be visible, and on click of the button, it becomes invisible. I need to do this functionality with dozens of forms in this app to create a single page app. 

 

Any ideas?!

 

1 ACCEPTED SOLUTION

Accepted Solutions
RandyHayes
Super User
Super User

@brandonkparker 

My suggestion is that you get rid of the concept of a variable for every form and use just one.

 

I cannot tell if the left buttons are part of a Gallery or if you actually added each button by hand.

But, the concept here is this:

Set one variable to the name (or number or whatever you want) of the form you want to display.

So, for example on the Patient Info button in the left nav,  Set a variable to a name:  Set(glbCurrentForm, "PatientInfo")

Now, on the Visible property of the Patient Info form, set it to : glbCurrentForm = "PatientInfo"

That form will then only be visible when that variable contains that value.

Do the same on all the other buttons and forms.

For you button in the form that you show, you can do one of two things:

1) Set the variable to blank - Set(glbCurrentForm, Blank())  This will make all forms disappear

2) Set the variable to the next form you want to show: Set(glbCurrentForm, "PatientInfo2")

 

This will give you much less variable juggling and will let you craft the flow of your app much better.

 

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

3 REPLIES 3
RandyHayes
Super User
Super User

@brandonkparker 

My suggestion is that you get rid of the concept of a variable for every form and use just one.

 

I cannot tell if the left buttons are part of a Gallery or if you actually added each button by hand.

But, the concept here is this:

Set one variable to the name (or number or whatever you want) of the form you want to display.

So, for example on the Patient Info button in the left nav,  Set a variable to a name:  Set(glbCurrentForm, "PatientInfo")

Now, on the Visible property of the Patient Info form, set it to : glbCurrentForm = "PatientInfo"

That form will then only be visible when that variable contains that value.

Do the same on all the other buttons and forms.

For you button in the form that you show, you can do one of two things:

1) Set the variable to blank - Set(glbCurrentForm, Blank())  This will make all forms disappear

2) Set the variable to the next form you want to show: Set(glbCurrentForm, "PatientInfo2")

 

This will give you much less variable juggling and will let you craft the flow of your app much better.

 

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

Perfect! Thanks Randy. That is a better way to do this.

RandyHayes
Super User
Super User

@brandonkparker 

Yes...much smoother!  

If this works for you, be sure to accept my response before as a solution so that others looking to do this, can find solutions quickly.  Thanks!

_____________________________________________________________________________________
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!

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

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