cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
fpc-kdrosario
Level: Powered On

Deleting a row from a collection after submitting the form successfully

Good day humans,

 

I have this application that can submit forms to a datasource.

Now, I tried implementing offline capability to this application which lead me on using collection (Coll_A) and localdata to store the submitted forms into a collection.

The user can still view the collection of forms submitted offline in the Gallery.

Now, the user can edit the forms and submit it.

Now, what I want is to delete that entry/row/form from the collection after successfully submitting it because there is now an internet connection.

 

I tried using:

Remove(Coll_A,ThisItem);

on the OnSelect property of my submit button. Unfortunately, it returns an error and it is considered an invalid argument.

 

Is the scenario I have in mind feasible? If yes, I hope you can help me build an approach to it.

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Deleting a row from a collection after submitting the form successfully

Hi @fpc-kdrosario ,

Do you want to remove the record from the local collection when you submit the form data successfully?

 

Based on the formula that you mentioned, I think there is something wrong with it. Please consider take a try with the following workaround:

Set the OnSuccess property of the Edit form to following:

Remove(Coll_A, LookUp(Coll_A, PrimaryColumn = EditForm1.LastSubmit.PrimaryColumn))

or

RemoveIf(Coll_A, PrimaryColumn = EditForm1.LastSubmit.PrimaryColumn)

Note: I assume that you submit your Edit form using SubmitForm function. The PrimaryColumn represents the column in your data source, which could identify one record uniquely.

 

If you use Patch function to submit your form data, please consider take a try with the following workaround:

Set the OnSelect property of the "Submit" button to following:

Set(SubmittedRecord, Patch('DataSource', Defaults('DataSource'), EditForm1.Updates));
RemoveIf(Coll_A, PrimaryColumn = SubmittedRecord.PrimaryColumn)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Eelman
Level 10

Re: Deleting a row from a collection after submitting the form successfully

Forms have a LastSubm function that stores data about the last record uploaded to a data source. I've not used it but maybe look into that for a solution.

Sorry I couldn't be anymore help.
Community Support Team
Community Support Team

Re: Deleting a row from a collection after submitting the form successfully

Hi @fpc-kdrosario ,

Do you want to remove the record from the local collection when you submit the form data successfully?

 

Based on the formula that you mentioned, I think there is something wrong with it. Please consider take a try with the following workaround:

Set the OnSuccess property of the Edit form to following:

Remove(Coll_A, LookUp(Coll_A, PrimaryColumn = EditForm1.LastSubmit.PrimaryColumn))

or

RemoveIf(Coll_A, PrimaryColumn = EditForm1.LastSubmit.PrimaryColumn)

Note: I assume that you submit your Edit form using SubmitForm function. The PrimaryColumn represents the column in your data source, which could identify one record uniquely.

 

If you use Patch function to submit your form data, please consider take a try with the following workaround:

Set the OnSelect property of the "Submit" button to following:

Set(SubmittedRecord, Patch('DataSource', Defaults('DataSource'), EditForm1.Updates));
RemoveIf(Coll_A, PrimaryColumn = SubmittedRecord.PrimaryColumn)

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (5,225)