cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
J0hn
Helper III
Helper III

True/False toggle to update sharepoint list with current date?

Hello All,

 

Is it possible to have a toggle switch that once toggled to true updates the list item on sharepoint? If so how can this be accomplished?

 

Thanks for your help,

2 ACCEPTED SOLUTIONS

Accepted Solutions
v-qiaqi-msft
Community Support
Community Support

Hi@J0hn,

Based on the issue that you mentioned, do you want to update the 'Date Last Submit' corresponding to the Month every time the Toggle is switched to yes?

Could you please share a bit more about the scenario?

I have a test on my side, please take a try as below:

Set the OnCheck property of each Toggle as below:

If(
    DataCardValue6.Value = true,
    Patch(
        Table1,
        LookUp(
            Table1,
            Month = DataCardValue8.Text
        ),
        {Date: Now()}
    )
)

Note: DataCardValue6 represents the Toggle corresponding to the certain question column in your SP list.

DataCardValue8 represents the TextInput corresponding to the Month column in your SP list.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

View solution in original post

@J0hn 

So it is an Excel file you want to update?  You originally mentioned that you had a SharePoint list that you wanted to update.  Can you clarify which you are doing?

Your lists both show months on them.  I assume that is the relationship between the two is significant.

You have the month shown on the top of your screen image.  That would be relevant.  How is that populate?  What is the Text property of that label?

 

Essentially what you are looking for will be this, on the OnCheck action of your checkbox:

   UpdateIf(yourList,  Month=yourlabelformula , {NameofTheColumnToWrite: Now()})

 

I would also recommend this in your OnUncheck:

  UpdateIf(yourList,  Month=yourlabelformula , {NameofTheColumnToWrite: Blank()})

 

This will reset the Excel value if the person unchecks the toggle.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

View solution in original post

7 REPLIES 7
RandyHayes
Super User
Super User

@J0hn 

You can go about it a few ways and I'm not entirely sure of your scenario.

But, in general, you can put a formula on the OnCheck action of the toggle and then:

   UpdateIf(yourList, criteria, {someRecord})

 

I hope this is helpful for you.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Thanks @RandyHayes Basically I have a powerapps form that is tied to a sharepoint list with simple yes/no toggles to answer questions. When the user toggles the switch to Yes i want to update the excel sheet with the current date that the toggle was toggles to Yes. The way I am think of it in my head would be If(sharepoint list, item=true then update the excel sheet table 1 , cell with today's date.

 

I have also tried doing this in power automate but I can only update the row and now just the specific cell I have added a couple screenshots perhaps that will better show what I am trying to do. 

v-qiaqi-msft
Community Support
Community Support

Hi@J0hn,

Based on the issue that you mentioned, do you want to update the 'Date Last Submit' corresponding to the Month every time the Toggle is switched to yes?

Could you please share a bit more about the scenario?

I have a test on my side, please take a try as below:

Set the OnCheck property of each Toggle as below:

If(
    DataCardValue6.Value = true,
    Patch(
        Table1,
        LookUp(
            Table1,
            Month = DataCardValue8.Text
        ),
        {Date: Now()}
    )
)

Note: DataCardValue6 represents the Toggle corresponding to the certain question column in your SP list.

DataCardValue8 represents the TextInput corresponding to the Month column in your SP list.

Hope it could help.

Regards,

Qi

Best Regards,
Qi

@J0hn 

So it is an Excel file you want to update?  You originally mentioned that you had a SharePoint list that you wanted to update.  Can you clarify which you are doing?

Your lists both show months on them.  I assume that is the relationship between the two is significant.

You have the month shown on the top of your screen image.  That would be relevant.  How is that populate?  What is the Text property of that label?

 

Essentially what you are looking for will be this, on the OnCheck action of your checkbox:

   UpdateIf(yourList,  Month=yourlabelformula , {NameofTheColumnToWrite: Now()})

 

I would also recommend this in your OnUncheck:

  UpdateIf(yourList,  Month=yourlabelformula , {NameofTheColumnToWrite: Blank()})

 

This will reset the Excel value if the person unchecks the toggle.

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@v-qiaqi-msft 

Hello Qi,

 

Thank you for your help I think we are almost there but I am receiving an error that the record isnt there even though it ? I have taken a screenshot of the formula and the error below. 

 

v-qiaqi-msft
Community Support
Community Support

Hi@J0hn,

Could you please check if you have connected the Excel table to your app?

In my scenario, I connected both my SP list and my Excel table to my app.

Based on the screenshot you provided, I think the key is the connection, please connect the Excel table to your app.

Hope it helps.

Regards,

Qi

Best Regards,
Qi

Thanks for your help in the end this is what my formula looked like:

 

If(DataCardValue3.Value=true,Patch(Table1,LookUp(Table1,Month=DataCardValue2.Text),{'Mo. Defibrillator Inspect. Cpl.':Now()}))

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,989)