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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Best Practices for Vis...
Power Apps
Answered

Best Practices for Visible property

(0) ShareShare
ReportReport
Posted on by 62

I have a best practice question: Currently working code for visibility is based on a SharePoint Choice Field for approximately 60 different fields. These fields are all columns in an SPL and typically have a beginning, end, and result column. All of these are governed by a Ctrl + C, Ctrl +V, of code like this 

If(DataCardValue24.Selected.Value = "abc"
|| DataCardValue24.Selected.Value = "123"
,true,false)

There can be quite a few options in the list. Having to update this in 4-5 places (Edit and Detail Screens) takes a bit of effort, would something like this work or be more efficient?  

If(DataCardValue24.Selected.Value = "abc"
|| DataCardValue24.Selected.Value = "123"
,
UpdateContext({ShowSection: true}), UpdateContext({ShowSection: false})

My main concern would be that the form is able to update as quickly as it currently does on change without the Context variable. I believe this would cut down on having to add 2 additional lines of code if I wanted to add "xzy" to the Choice Field.  Thank you!

Categories:
I have the same question (0)
  • KrishnaV Profile Picture
    5,023 on at

    Hi @crjwarre ,

     

    Sorry to say that your requirement was not so quite clear to me, would you mind explain me with some screen shots to help you better. 

    Again, may be I am not able to understand 😥


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

  • crjwarre Profile Picture
    62 on at

    Here is what the Visible Code is Controlling. There is the example for Start and End in this screen clipping.InitialScreen1.pngFormatScreen.png

  • crjwarre Profile Picture
    62 on at

    @KrishnaV  the goal is to be able to add more choices to the Format field with less code.

  • Verified answer
    KrishnaV Profile Picture
    5,023 on at

    Hi @crjwarre ,

     

    try Switch case in onChange property of the Format field and update a local variable with

    UpdateContext({ShowSection: true}

    Ex:

    Switch( DataCardValue24.Selected.Value, 
    "abc", UpdateContext({variable:tue}), 
    "123", UpdateContext({variable:tue}),
    UpdateContext({variable:false}))// this will get exicute only if the value is none of them

    This will improve the performance of the app.


    I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

    Regards,
    Krishna
    If this post helps you give a 👍 and if it solved your issue consider Accept it as the solution to help the other members find it more.

     


     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 335 Most Valuable Professional

#2
11manish Profile Picture

11manish 166

#3
sannavajjala87 Profile Picture

sannavajjala87 71 Super User 2026 Season 1

Last 30 days Overall leaderboard