Delete Express entries in bulk
Permalink
I have a client that receives hundred of registrants through a series of Express Object, on a quarterly/seasonal basis. I actually have four Express objects, one for each season. We've now cycled through the year, and we're preparing for a second run for the fall season and need to purge that express object of hundreds of entries from last year. I only see a means of deleting an individual Express entry. Please tell me there is a means to select multiple, or an entire batch of entries and delete them. Deleting them one at a time would be a painfully tedious process.
I originally posted this question under the 'editing' forum but its getting no response.
Forgive me but i need to find a solution in the next few days.
I originally posted this question under the 'editing' forum but its getting no response.
Forgive me but i need to find a solution in the next few days.
Thank you for the quick response, shahroq,
I must say that I'm frustrated to be blindsided by what I unfortunately assumed would be a natural feature of any data entry system. Shame on me for making any assumptions. I love Concrete5. Its Express Object functionality is simply brilliant. The power of what it offers in regards to capturing and outputting data is frankly unsurpassed by any other CMS I've encountered. The fact that Express is so configurable on the 'front end' is very empowering for your average (or slightly advanced) user. It makes C5 an easy sell for my clients. That said, to deny the average user the ability to conveniently delete large chunks of data via the dashboard simply neuters the power of Express, and is frankly anathema to the most basic concepts of a content management system. This puts me in a very awkward position with my client(s) as they will never be comfortable implementing the code you've kindly provided, but rather, we've indeed assured their utter dependence on me or another coder. I never put my clients in that position without a lot of discussion and forethought. At this point I now feel compelled to do work for free (probably for numerous clients that will eventually need to purge their data) because I've blindly steered them down a path I probably shouldn't have...which is frankly embarrassing. This now makes C5 a much harder sell. Lack of bulk deletion is shockingly disempowering and dramatically undercuts all of the hard work the Core Team has put into creating such a nimble and graceful system.
shahroq, I appreciate your reference to 'the current version of C5 is not capable of deleting entries in batch' in hope the 'concrete5 team' comes to terms with the necessity for this basic feature in the next iteration.
I don't mean to sound like a tyrant, I truly love C5, but one has to admit without this feature we greatly alienate anyone dependent on 'front management' of their content 'management' system. 😉
As for the technical aspects of the code I am very grateful you've provided, shahroq, I can say I'm comfortable attempting to implement it to a certain degree, but unfortunately I am not the coder that you are. With that in mind I have two questions:
1. //then iterate through entities and delete theme based on your specific criteria:
a. I have no specific criteria in the fact that I want to delete every entry for that express object. So my question is, must I actually specify any criteria?
2. should the browser request of http://ursite.com/testapi actually have a 7 on the end to match the echo statement = ?
Thank you.
A very frustrated, (and now cautious) fan.
I must say that I'm frustrated to be blindsided by what I unfortunately assumed would be a natural feature of any data entry system. Shame on me for making any assumptions. I love Concrete5. Its Express Object functionality is simply brilliant. The power of what it offers in regards to capturing and outputting data is frankly unsurpassed by any other CMS I've encountered. The fact that Express is so configurable on the 'front end' is very empowering for your average (or slightly advanced) user. It makes C5 an easy sell for my clients. That said, to deny the average user the ability to conveniently delete large chunks of data via the dashboard simply neuters the power of Express, and is frankly anathema to the most basic concepts of a content management system. This puts me in a very awkward position with my client(s) as they will never be comfortable implementing the code you've kindly provided, but rather, we've indeed assured their utter dependence on me or another coder. I never put my clients in that position without a lot of discussion and forethought. At this point I now feel compelled to do work for free (probably for numerous clients that will eventually need to purge their data) because I've blindly steered them down a path I probably shouldn't have...which is frankly embarrassing. This now makes C5 a much harder sell. Lack of bulk deletion is shockingly disempowering and dramatically undercuts all of the hard work the Core Team has put into creating such a nimble and graceful system.
shahroq, I appreciate your reference to 'the current version of C5 is not capable of deleting entries in batch' in hope the 'concrete5 team' comes to terms with the necessity for this basic feature in the next iteration.
I don't mean to sound like a tyrant, I truly love C5, but one has to admit without this feature we greatly alienate anyone dependent on 'front management' of their content 'management' system. 😉
As for the technical aspects of the code I am very grateful you've provided, shahroq, I can say I'm comfortable attempting to implement it to a certain degree, but unfortunately I am not the coder that you are. With that in mind I have two questions:
1. //then iterate through entities and delete theme based on your specific criteria:
a. I have no specific criteria in the fact that I want to delete every entry for that express object. So my question is, must I actually specify any criteria?
2. should the browser request of http://ursite.com/testapi actually have a 7 on the end to match the echo statement =
echo "Test API7:<br>";
Thank you.
A very frustrated, (and now cautious) fan.
Hi,
If you don't have any specific criteria and intend to remove all entries, skip the "if" part.
And the "echo" part just indicates that you are at the block. You can comment that part out, too.
If you don't have any specific criteria and intend to remove all entries, skip the "if" part.
And the "echo" part just indicates that you are at the block. You can comment that part out, too.
Thank you, shahroq,
In looking at your original post I'm not sure how I ended up with a mysterious 7 that appeared in my cut and paste of your message...which would render my second question above obsolete.
That said, to avoid confusion, would you mind showing me the abbreviated snippet for \application\bootstrap\app.php without the echo statement?
Thank you.
In looking at your original post I'm not sure how I ended up with a mysterious 7 that appeared in my cut and paste of your message...which would render my second question above obsolete.
That said, to avoid confusion, would you mind showing me the abbreviated snippet for \application\bootstrap\app.php without the echo statement?
Thank you.
Oh, I now get it. The echo statement is essentially a "hello world!" to confirm I completed the function through the browser.
Thank you once again, shahroq.
Just to be clear. would I place the entirety of the code below in \application\bootstrap\app.php
Just to be clear. would I place the entirety of the code below in \application\bootstrap\app.php
$entity = Express::getObjectByHandle('entity_handle'); $entityList = new EntryList($entity); $entities = $entityList->getResults(); foreach ($entities as $entity) { Express::deleteEntry($entity); }} Route::register('/testapi', function() { echo "Test API:"; //... return '';});
The code should be like this:
Route::register('/testapi', function() { echo "Test API:"; $entity = Express::getObjectByHandle('entity_handle'); $entityList = new EntryList($entity); $entities = $entityList->getResults(); foreach ($entities as $entity) { Express::deleteEntry($entity); } return ''; });
You can use this cheat sheet for more info as to how obtain the each entry's timestamp:
https://github.com/shahroq/whale_c5_cheat_sheet#express-entry...
You can place this code inside your site \application\bootstrap\app.php and run it by the browser (http://ursite.com/testapi)