Script To Delete In Bulk - Forum - Rollbase - Progress Community

Script To Delete In Bulk

 Forum

Script To Delete In Bulk

This question is not answered

Hi All,

How can I delete set of records that meet the condition in Rollbase? For example, If I want to delete all the records that has 'expired' status. 

I am looking for a better option then running a query to get the list of ids and calling 'rbv_api.deleteRecord' for each id.

Thanks in advance,
Ithrees

All Replies
  • I've used batch jobs for these types of situations when considering a "single runtime" scenario or a "scheduled runtime" scenario. Makes life easier.

    Just supply a simple condition

    e.x. if ("{!status#code}" == "expired") rbv_api.deleteRecord([supply params here]);

    For single runtime, don't deploy the batch job and just manually run it using "run now".

    For scheduled runtime, deploy the batch job so it runs given its schedule.

    Hope this helps you out.

  • Dear mpiscoso@gmail.com,

    Thank you for your reply. This method is OK for the manual processing but in my case I have to include the deleting part inside the application scripts to execute it with the application logic. Something similar to SQL DELETE.

    -Ithrees

  • I see . Can you describe the use-case for me? Would it be something transactional such as you a create a record on a different object and specify the conditions for deletion and a server-side script would run to delete the records that match the criteria? If this is the use-case, I think the best way to go is still to use rbf_selectQuery() + rbf_deleteRecord(). It would most likely offer the best performance out of all the methods as per my experience.

    If you were to work in the client-side, you would have access to getPage() which accepts a View's original ID and inherits the filters of the supplied view and will then return to you the records that match the view's filters' criteria. It's performance is poor for me though. Even when trying 5 records with this API i get really slow load times.

    May I know why you are looking for a better option?

    Hope this helps.

  • Thank you mpiscoso@gmail.com,

    I want to do this from the client-side. There is an UI page for planning in my application where I create many records in many tables. In certain cases I have to delete many records relate to that logic and after deleting I have to continue with something. As the response time is critical in this application It would be better to make a single call to delete all and do the rest in the callback rather than making too many calls to the server to delete each and then to continue.

    -Ithrees

  • If you're page is purely code built, then I suggest you use the REST API > deleteArr()

    Link: documentation.progress.com/.../index.html

    It can delete multiple records with a single call and you can use jquery to do .ajax() or similar to invoke it.

    Hope this helps.

  • I think it is better to have similar bulk deleting api for both client and server side in future.

  • You may also perform that API and other REST APIs in the server side using sendJSONrequest() I believe.