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 / Use a toggle to update...
Power Apps
Unanswered

Use a toggle to update data source

(0) ShareShare
ReportReport
Posted on by 2

I'm currently referencing the previous question on toggle updates (Solved: Use a toggle to change a field - Power Platform Community (microsoft.com)) and cant quite seem to configure my app to this.

 

What I need to do is have a toggle button on my app "On/Off" based on a field / created column in my database called "IncludeInModel" but once selected to On and submitted my data source column returns NULL values where I would like it to return 1 or 0 .

 

Niiru_1-1641986742891.png

 

 

Niiru_0-1641986680743.png

 

The toggle button is contained in an editform -> card

Niiru_2-1641987199225.png

 

I have tried editing the:

 

Check: Patch('dbo.SampleTable',LookUp('dbo.SampleTable',IncludeInModel=ThisItem.IncludeInModel),{IncludeInModel:1})

Uncheck: Patch('dbo.SampleTable',LookUp('dbo.SampleTable',IncludeInModel=ThisItem.IncludeInModel),{IncludeInModel:0})

 

 

But the updated rows continue to return NULL values for the IncludeinModel in the database.

Niiru_3-1641987502738.png

 

Is there a different formula I should be using for Check/Uncheck options?

Categories:
  • Niiru Profile Picture
    2 on at

    Note: I have a button to perform the patch with the following formula:

     

    Patch('dbo.SampleTable', Defaults('dbo.SampleTable'), SubmitterName: User().FullName,DateModified: Now(),IncludeInModel:DataCardValue4.Value}); PowerBIIntegration.Refresh();
    Navigate(Screen4)

     

    Patch('dbo.SampleTable',
    Defaults('dbo.SampleTable'),
    {SubmitterName: User().FullName,
    DateModified: Now(),
    IncludeInModel:If(DataCardValue4.Value=false,1,0)});
    PowerBIIntegration.Refresh();
    Navigate(Screen4)

     

    and this returns 0 values in my data source. Is there a way to change this so 1s & 0s appear depending on toggle.

    Niiru_0-1641992533150.png

     

  • v-JessicaG-msft Profile Picture
    Microsoft Employee on at

    Hi @Niiru ,

     

    Is your formula unable to update different values to the table based on the toggle state? What is the data type of your "IncludeInModel" column? If it is not number type, you need to use "1" "0".

     

    In the formula "If(DataCardValue4.Value=false,1,0)});" , when the toggle is on, it is true and the 0 value , and when the toggle is off, it is false and the 1 value.

     

    vJessicaGmsft_0-1642155526187.png

    Formula:

    Patch('dbo.SampleTable',
    Defaults('dbo.SampleTable'),
    {SubmitterName: User().FullName,
    DateModified: Now(),
    IncludeInModel:If(DataCardValue4.Value,0,1)}); // (You could use the toggle value to determine true and false)
    

    Best Regards,

    Jessica Gu

     

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 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard