cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ocin33
Helper II
Helper II

Issue with form clearing, variable and clearing the sharepoint list

Hello,

I am the beginner and have a problem with power apps app.

I have the Sharepoint list with particular dates that can be chosen in the app. User chooses the date, put data and everything appears on the sharepoint list. The problem is when I want to delete data. I put the button that sets variable, then the variable is used to change Yes/No button to "No", then other fields are cleared with IF function related with the variable.

 

The issue is:

1. Data do not vanish fron the sharepoint list. Only the "Yes/No" button changes:

ocin33_1-1627045818514.png

 

2. When I use the button once, other records do not have the preview. All fields are empty in the application because Yes/No button is left to "No" while it is "Yes" on the sharepoint list

ocin33_0-1627045792471.png

 

Can you tell me what to change to achieve my goal (delete data from the sharepoint)

In attachements you can find screens presenting the app and formulas 

 

1 ACCEPTED SOLUTION

Accepted Solutions

To do more surgical changes, use the Patch() function to set specific fields to desired values:

 

Patch(mySPList,
    ThisItem,
    {
        ColumnName1: "",
        ColumnName2: ""
        // and so on to change/clear the fields you want to change
    }
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

13 REPLIES 13
BCLS776
Super User
Super User

If the record is currently displayed in a gallery, you can user Remove(mySPList, ThisItem) on a button in the gallery to delete the record completely.

 

However, there is value in keeping the record and flagging it as active or inactive if there's a chance a user might want to "un-delete" it or access the info again. You can Filter other galleries/collections to work with active records only if you like.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

In this case I do not want to delete the whole record from the list but I want only to change the last column (Yes/No column) to "No" and clear all columns except two first ones. How to do this?


To sum up, I need to choose something in the galery and have option to change something in the form (it works now) or to clear mentioned column 😕

To do more surgical changes, use the Patch() function to set specific fields to desired values:

 

Patch(mySPList,
    ThisItem,
    {
        ColumnName1: "",
        ColumnName2: ""
        // and so on to change/clear the fields you want to change
    }
)
_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

View solution in original post

Do I understand correctly? I need to put this formula in the button, yes? It will clear data only in the choosen record, not the whole sharepoint list, yes?

When I try to do this, "ThisItem" is impossible to choose 😕

 

ocin33_0-1627068914185.png

 

Correct, put this on the OnSelect of a button in the gallery frame and it will apply it to only that item (ThisItem is the identifier of the current record)

 

Note, you will need to adjust the code to show your column names and data types applicable to your columns. My example is for single line of text columns. 

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.

Sorry, forgot to address your second question: if you are working outside of a gallery and can't use ThisItem, then you need to replace that part of the Patch() with a Filter statement that pulls out only the record you wish to edit. The Patch will apply to all records that Filter returns.

_________________________________________________________________________________________
Help the community help more users by choosing to "Accept as Solution" if this post met your needs. If you liked the post and want to show some appreciation, please give it a Thumbs Up.
Ramole
Memorable Member
Memorable Member

Hi @ocin33 

Is toggle inside a form ?

 

ThisItem only availble within a form or gallery but if you need to use a button outside you will need to use  variable like Set(varRecord,ThisItem) or even Gallery.Selected.controlname

 

Also you put the Patch direct the toggle onchange

 

 

 

 

Thank you
If this post helps, then please consider Accept it as the solution to help the others and consider giving it a "Thumbs Up."

Hi,
if you mean the "Yes/No" column, it is in the form:

ocin33_0-1627069953603.png

 

Can you show me the exemplary formula with "Filter"? I need to choose the record and clear columns of this chosen record outside the gallery.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (2,546)