Jump to content

Dynamically Delete All Records In A Table


Recommended Posts

Good morning,

 

 

After removing a record , it is necessary to also delete a number of other records. I now have a tabular datapage with the records to be deleted which automatic  appears after the first datapage .Is there a way  to dynamically delete all records in this report .so everything happens in  one time after submit the first datapage.

 

 

Regards Peter.

Link to comment
Share on other sites

You need some way to query the records that you want to delete. e.g. WHERE yourfield = view_field.

 

I am using "soft deletions" to manage this kind of thing.

child - parent - grandparent

 

When parent or grandparent is marked as "delete," then the View that shows the child hides if parent or grandparents is marked "delete." This is effectively the same as cascading behavior, but allows you to undo your changes. It still requires some criteria by which you delete ALL matching records.

Link to comment
Share on other sites

Hi aam82

 

In fact, I now have something in the 2nd data page ,

These are the records that are no longer relevant as the record in the previous datapage is deleted. The record in the first datapage   has already gone so is there is no need to make the other soft deleted.  So to keep the database clean they must also deleted .

So basically I am looking for a script in the footer of the 2nd data page that all records in that datapage deleted and autosubmit .

Link to comment
Share on other sites

I think you'll need to cycle through the records and delete them one at a time. You can build an auto deleting details DataPage that will do this for you.

 

 

based on-> http://forums.caspio.com/index.php/topic/4314-js-auto-submit-a-datapage/ with some changes

<script type="text/javascript">
  if(document.getElementById("caspioform")) {
  document.getElementById("caspioform").style.display = 'none';
  setTimeout('document.getElementById('Mod0DeleteRecord').click()',300); } 
</script>

Destination after record update "Go to the next record"

Link to comment
Share on other sites

Tank you Chad,

It works almost perfectly , even if the last record is deleted I'll send him back to the previous data page . the only thing is the confirmation popup when deleting . This still needs to be confirmed manually. Can we work around this?

 

Regards Peter

 

html block

<script type="text/javascript">
  if(document.getElementById("caspioform"))
document.getElementById("caspioform").style.display = 'none';
 {
  setTimeout('document.getElementById("Mod0DeleteRecord").click();',300);}
</script>

Define Localization Settings, element 351 :   

<div id="geenruit"><h3>No records</h3></div>

footer

<script>

/*if no records */
if (document.getElementById("geenruit"))
{
window.location="[@app:downgrade_verwijderen]"; 
}

</script>  
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...