peterhanse Posted March 13, 2016 Report Share Posted March 13, 2016 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. Quote Link to comment Share on other sites More sharing options...
svitlanataran Posted March 14, 2016 Report Share Posted March 14, 2016 Hi Peter, Do you have relationships between tables? You can enable referential integrity and cascade-delete related records. You can find more information here Quote Link to comment Share on other sites More sharing options...
peterhanse Posted March 14, 2016 Author Report Share Posted March 14, 2016 Hello Matilda, I have relationships between tables, but the problem is that not all te relations of that records must be deleted. So unfortunately, this will not work . Peter. Quote Link to comment Share on other sites More sharing options...
svitlanataran Posted March 14, 2016 Report Share Posted March 14, 2016 You could enforce referential integrity only for specific relationships. For example, one table has 3 relationships. You can delete related records only for one relationship. Quote Link to comment Share on other sites More sharing options...
peterhanse Posted March 14, 2016 Author Report Share Posted March 14, 2016 Sorry I explained it wrong. the data is in the same table. Maybe a different way. is it perhaps become easier to get a java script .And all records in the second table at once to delete, and redirect to the homepage. Quote Link to comment Share on other sites More sharing options...
aam82 Posted March 15, 2016 Report Share Posted March 15, 2016 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. Quote Link to comment Share on other sites More sharing options...
peterhanse Posted March 15, 2016 Author Report Share Posted March 15, 2016 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 . Quote Link to comment Share on other sites More sharing options...
peterhanse Posted March 18, 2016 Author Report Share Posted March 18, 2016 I have once seen on topic , "delete all records". but could not find him . Does anyone know Regards Peter Quote Link to comment Share on other sites More sharing options...
LWSChad Posted March 18, 2016 Report Share Posted March 18, 2016 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" peterhanse 1 Quote Link to comment Share on other sites More sharing options...
peterhanse Posted March 19, 2016 Author Report Share Posted March 19, 2016 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> Quote Link to comment Share on other sites More sharing options...
LWSChad Posted March 21, 2016 Report Share Posted March 21, 2016 Ohhhh, I didn't think about that. IDK if that can be worked around. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.