web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Toggling form visibili...
Power Apps
Unanswered

Toggling form visibility based on radio button value

(0) ShareShare
ReportReport
Posted on by 169

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!

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

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

  • illmatic Profile Picture
    169 on at

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

  • Verified answer
    RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

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

  • illmatic Profile Picture
    169 on at

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

  • RandyHayes Profile Picture
    76,297 Super User 2024 Season 1 on at

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard