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 / Toggle, Condition, Pat...
Power Apps
Answered

Toggle, Condition, Patch not Working Together

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I have a Toggle that designates 'Compliance', 'Noncompliance' based on a condition.

 

The Toggle has Patch functions back to an SP List:

 

OnCheck:

Patch(
MemberList,
LookUp(MemberList,FullNm=ECMemberSearchDD.Selected.FullNm),
{
ComplianceStatus: "Compliant"
}
);

 

OnUnCheck:

Patch(
MemberList,
LookUp(MemberList,FullNm=ECMemberSearchDD.Selected.FullNm),
{
ComplianceStatus: "Noncompliant"
}
);

 

My issue is the Toggle doesn't seem to be resetting/refreshing/updating the data when the Member's name is changed (by Dropdown). If one Member is Noncompliant, and the next Member is Noncompliant no Patch is taking place, even though it may be an overwrite of the existing 'Noncompliant' status. If the name change is from 'Compliant' to 'Noncompliant' or reverse, the Patches work fine.

 

This sounds contrary; however the issue further is the 'ComplianceStatus' is a new column in the SP List. Consequently, the column is empty for most of the 800 Members. When I go through multiple names in the app that are all 'Noncompliant' nothing happens. Is there a way to reset/refresh the Toggle when a new name is chosen in the Dropdown so that regardless of the content in the SP ComplianceStatus list column a Patch takes place, even if an overwrite?

Categories:
  • Verified answer
    Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @Anonymous 

    A toggle can only have a value of true or false.  It takes a little coding to set it's default value and to use its value to enter text into a column.  So for setting the default for an item in a gallery

     

     

    If(ThisItem.compliancestatus = "Compliant",true,false)

     

     

    Likewise in an edit form, the Update property of the card for compliancestatus containing a toggle would be:

     

     

    If(Toggle1.Value=true,"Compliant","NonCompliant")

     

    In a Patch function, 

    Patch(
    MemberList,
    LookUp(MemberList,FullNm=ECMemberSearchDD.Selected.FullNm),
    {
    ComplianceStatus: If(Toggle1.Value = true,"Compliant")
    }
    )
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you. 

     

    Can you tell me why it is whenever I manually change the Toggle my Dropdown and Gallery default to the default name / based on location as determined by a Dropdown in a previous screen?

     

    When I get to the screen I see the names I should see in the combbox, based on the Location. However, once I switch names and then manually change the Toggle the entire thing resets, as if my toggle control has a reset screen to default condition; which it does not. Thoughts?

     

    Also, I'm using the OnCheck, OnUnCheck for my Patch statements.

     

    Should I have one statement in the OnChange? Could that be the problem?

     

    I'm really perplexed. I don't under why a change toggle should reset the controls and data.

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 July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 393 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 278 Most Valuable Professional

Last 30 days Overall leaderboard