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

Toggling form visibility based on radio button value

I have a canvas app with multiple screens.  Screen 1 has radio button choices [Choice A, Choice B, Choice C].  Screen 2 has corresponding forms [Form A, Form B, Form C].  When a user selects a choice, they are navigated to Screen 2 which displays the corresponding form.  [IE, User selects Choice A on first screen, and navigates to screen 2 showing Form A only].   The rest of the forms are hidden.   I am having trouble toggling visibility based on the radio button's selected value.

 

I have set a global variable on the app:  Set(varProjectType, Radio1.Selected.Value)   to store the users choice.

Then, on each of the forms, I have set the Visible property to:   If(varProjectType = "Choice", true, false).  My assumption is that it checks if the user's choice is equal to the string, then set the Visible property to true if it's true, or false if it's not.   This would toggle the visibility accordingly.   Instead, even when the selected Choice equals the text, the form is not visble.


I can't figure out what I'm doing wrong...    I could set the Visible property to show If(Radio1.Selected.Value="Choice A") on the form, but this would cause performance degradation so I'm trying to toggle in the most efficient way.  

 

Please advise.  Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

@illmatic 

I would pretty much ignore it. 

We use it all the time this way and have Never seen any degradation in performance or other impact.

 

Consider what you are doing...adding a formula to set a variable. 

1) The overhead of the app having another object.

2) The cycles to set the variable.

3) The maintainability to the designer of keeping the variable current whenever your Radio1 changes - your variable will not update itself - you will need to put the formula in to update your variable if the control changes

 

PLUS...and this is the biggest point, when you set your variable each time, you are referring to Radio1.Selected.Value.  So if your Form refers to it as well, what is the difference?  I would say it is the difference of 1 reference. 

With a variable, again you will have to maintain it and keep it current with the control value.  That means many references to the control over and over.  Then, your Form Visible property will need to reference your variable.

 

I've never brought this point to a head, but I strongly contest that there is any performance degradation as I have never (in hundreds of apps) experienced a millisecond of degradation.  And again, we use this method in almost ALL the apps.  They become much easier to maintain when you ditch the variables.

 

Anyway...I could go on and on, but I think you got the point.

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

View solution in original post

5 REPLIES 5
Super User III
Super User III

@illmatic 

Why do you feel there is a performance degradation? 

That would be my recommended method.  Setting a variable for something that you already have a variable for (the control property) is redundant and you would need to constantly keep that updated in your own formulas.

 

So, I would recommend that in your Form Visible property that you have the following formula:

Radio1.Selected.Value="Choice A"

 

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!

@RandyHayes 

When going through the app to check for errors etc, the system message noted that the first method [the one you suggested] would cause degradation in performance since I was referencing data controls on a different screen and suggested to use variables, update context, or a collection.

@illmatic 

I would pretty much ignore it. 

We use it all the time this way and have Never seen any degradation in performance or other impact.

 

Consider what you are doing...adding a formula to set a variable. 

1) The overhead of the app having another object.

2) The cycles to set the variable.

3) The maintainability to the designer of keeping the variable current whenever your Radio1 changes - your variable will not update itself - you will need to put the formula in to update your variable if the control changes

 

PLUS...and this is the biggest point, when you set your variable each time, you are referring to Radio1.Selected.Value.  So if your Form refers to it as well, what is the difference?  I would say it is the difference of 1 reference. 

With a variable, again you will have to maintain it and keep it current with the control value.  That means many references to the control over and over.  Then, your Form Visible property will need to reference your variable.

 

I've never brought this point to a head, but I strongly contest that there is any performance degradation as I have never (in hundreds of apps) experienced a millisecond of degradation.  And again, we use this method in almost ALL the apps.  They become much easier to maintain when you ditch the variables.

 

Anyway...I could go on and on, but I think you got the point.

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

View solution in original post

Lol, still I do appreciate your long winded reply all the same ;).  Less work for me!  Thanks for your insights 🙂

@illmatic 

Yeah, I am busy on an app and was procrastinating by going on and on.  😉

Trust me though, once you get away from "variable management" in your app, the easier PowerApps becomes.

 

I am glad you found it helpful.

_____________________________________________________________________________________
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 (7,222)