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 / Toggle (yes/no) choice...
Power Apps
Answered

Toggle (yes/no) choice does not stick

(0) ShareShare
ReportReport
Posted on by 248

Hello again.

 

I created a canvas app that is connected to a sharepoint list.  I have a screen that has a gallery on the left and form data on the right.  One of the columns is a yes/no toggle.  When the user chooses a yes/no, the choice reverts back to the original.  The formulas that i am using are:

 

OnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':true,'Exported by whom':User().FullName,'Exported Date':Now()});

 

UnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':false,'Exported by whom':User().FullName,'Exported Date':Now()});

 

Default on the datacard:  Blank

Default on field:  If(ThisItem.'Has the pdf been exported?'= true, true, false)

 

When the user toggles, you can see in the gallery the one that was selected "blinks" and then goes back to the original choice.

 

Any ideas?  

 

Thank you for your time!

Categories:
I have the same question (0)
  • v-bofeng-msft Profile Picture
    on at

    Hi @Misa ,

     

    You could set the toggle's default to:

     

    LookUp('Letter Templates',ID=gal_EmpList.Selected.ID).'Has the pdf been exported?'

     

    Best Regards,

    Bof

  • Misa Profile Picture
    248 on at

    Thank you for your response @v-bofeng-msft.  I tested the formula and it is still reverting back.

  • v-bofeng-msft Profile Picture
    on at

    Hi @Misa ,

     

    Could you please show me some screenshots?

     

    In addition, maybe you could try:

     

    OnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':true,'Exported by whom':User().FullName,'Exported Date':Now()});Refresh('Letter Templates');ResetForm(FormName)

     

    UnCheck:  Patch('Letter Templates',LookUp('Letter Templates',ID=gal_EmpList.Selected.ID),{'Has the pdf been exported?':false,'Exported by whom':User().FullName,'Exported Date':Now()});Refresh('Letter Templates');ResetForm(FormName)

     

    Default on the datacard:  Blank

    Default on field:  LookUp('Letter Templates',ID=gal_EmpList.Selected.ID).'Has the pdf been exported?'

     

    Best Regards,

    Bof

  • Misa Profile Picture
    248 on at

    Of course @v-bofeng-msft .  To make sure i send the correct screenshots, which would you like?

  • v-bofeng-msft Profile Picture
    on at

    Hi @Misa ,

     

    Could you please show me ,

    Where is the toggle? In the gallery or in a form?

    What is gal_EmpList? Is it a gallery?

    What is gal_EmpList's items property? What is the form's data source? What is the form's item property?

    What is 'Has the pdf been exported?'? Is it a 'Yes/No' column?

     

    vbofengmsft_0-1675218497617.png

     

    Bes Regards,

    Bof

     

     

  • Misa Profile Picture
    248 on at

    @v-bofeng-msft 

    Where is the toggle? In the gallery or in a form?  The toggle is on the form, not the gallery

    What is gal_EmpList? Is it a gallery? gal_Emplist is the gallery

    What is gal_EmpList's items property? What is the form's data source? What is the form's item property?  Items property:  Filter('Letter Templates', lbl_SearchBox.Text in 'Employee Name'.DisplayName || lbl_SearchBox.Text in 'Employee Name'.Claims)

    What is 'Has the pdf been exported?'? Is it a 'Yes/No' column? Yes

     

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Misa ,

     

    Could you please tell me:

    What is the form's data source? What is the form's item property ?

     

    If the form's data source is 'Letter Templates' and the form's item is gal_EmpList.Selected, you could try:

     

    OnChange:  Patch('Letter Templates',ThisItem,{'Has the pdf been exported?':Self.Value,'Exported by whom':User().FullName,'Exported Date':Now()});

     

    Toggle's default :  ThisItem.'Has the pdf been exported?'

     

    vbofengmsft_0-1675220726801.png

    vbofengmsft_1-1675220737650.png

    vbofengmsft_2-1675220751547.png

     

     

     

    Best Regards,

    Bof

     

     

  • Misa Profile Picture
    248 on at

    My apologies @v-bofeng-msft .  Yes you were correct.  I commented out the formulas in both OnCheck/UnCheck and added the formula to OnChange and the toggle stayed.  Woohoo!  

     

    Thank you so much for your assistance!!

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 721 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard