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 / visible fields based o...
Power Apps
Answered

visible fields based on toggle

(0) ShareShare
ReportReport
Posted on by 726

I am trying to set a fields viable depending on if a toggle is true, 

 

If the first part its if toggle 1 is true to set value P to true

on second toggle it is to set only C to true 

 

but if both toggles are true to set both C and P as true

 

The first two parts work, its only when both are true is it not showing both P and C as true

 

Here is my code this is done on the select of a button. 

 

If(Toggle2.Value, true; Set(c, false) & Set(p, true) & Set(i, false), If(Toggle1.Value, true; Set(c, true) & Set(p, false) & Set(i, false), If(Toggle1.Value, true & Toggle2.Value, true, Set(c, true) & Set(p, true) & Set(i, false))))

 

 

Categories:
  • FabianAckeret Profile Picture
    975 on at

    @amyharkus86 

     

    Is this what you'd like to achieve?

    cpi.gif

     

    I created this by using the following formula on Toggle1:

     

    If(
     Self.Value && Toggle2.Value = false, 
     Set(c,true);
     Set(p,false);
     Set(i,false),
     Self.Value && Toggle2.Value,
     Set(c,true);
     Set(p,true);
     Set(i,false)
    );

     

     

    and this on Toggle2

     

    If(
     Self.Value && Toggle1.Value = false, 
     Set(c,false);
     Set(p,true);
     Set(i,false),
     Self.Value && Toggle1.Value,
     Set(c,true);
     Set(p,true);
     Set(i,false)
    );

     

     

    I hope this helps. Please let me know.

     

    Should this answer help you, please mark it as a solution.

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    Hi @amyharkus86 ,

    Try

    Set(p,Toggle1.Value);
    Set(c,Toggle2.Value);
    Set(i,false)

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • amyharkus86 Profile Picture
    726 on at

    Hi @WarrenBelz  your fist reply is accurate ish, i only want the visibly of these to change on button click as it then takes them to another view 

     

    On toggle1 Oncheck i have this 

    true & UpdateContext({varContractSub: "No"}); UpdateContext({varContractName:"Internal Transfer/Change Of Role & Contract Particulars"}); If(Toggle2.Value = true, UpdateContext({varContractName:"Internal Transfer/Change Of Role & Contract Particulars & Pay & Benefits"}))

    on toggle 2 Oncheck i have this 

    true & UpdateContext({varContractSub: "No"}); UpdateContext({varContractName:"Internal Transfer/Change Of Role & Pay & Benfits"}); If(Toggle1.Value = true, UpdateContext({varContractName:"Internal Transfer/Change Of Role & Contract Particulars & Pay & Benefits"}))

     On the button i have 'Next' on select i want to have if toggle one is selected to view 'C' fields, I have a bunch of required fields for c that are set visible = c 

    same for toggle two but instead p 

     

    i want to view both the fields in c and p if both toggles are true.

     

    I dont want the change to happen on the toggle as visible on the submitted button based on these toggles, if they are both false then the submitted but is visable, if one of them is true the 'Next' button is instead visible.

     

    So although the above works i dont want to make the change on the toggles. 

     

  • Verified answer
    FabianAckeret Profile Picture
    975 on at

    @amyharkus86 

     

    In this case, you can use the following formula on your next button:

     

     

    If(
     Toggle1.Value && Toggle2.Value = false,
     Set(c,true);Set(p,false);Set(i,false),
     If(
     Toggle2.Value && Toggle1.Value = false,
     Set(c,false);Set(p,true);Set(i,false),
     If(
     Toggle2.Value && Toggle1.Value,
     Set(c,true);Set(p,true);Set(i,false),
     Set(c,false);Set(p,false);Set(i,false)
     )
     )
    )

     

     

    Then, on all the fields that need to be visible/not visible, add the corresponding variables (c, p, i) to the Visible property. There might be an easier way with Switch, but this should do the job as well.

  • WarrenBelz Profile Picture
    156,774 Most Valuable Professional on at

    @amyharkus86 ,

    Good that @FabianAckeret has solved this for you.
    I have been offline for the last two days due to location.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 225

#3
M Bilal Khan Profile Picture

M Bilal Khan 192

Last 30 days Overall leaderboard