Delete several table records

Hi there,
I know how to delete a complete table, but I’m looking for a smarter way to delete several records of a table at once.
Use case:
I use a table for storing collected articles by order. When an order has been completely collected and I press “complete order”, then I like to delete all records only for this order, without deleting the still open orders yet.

Because I can not use filter arguments in the table api for deleting records, I use the workaround to collect per query all record-ids for the order, store these in an array, push this onto the looper custom widget, where I pop each ID from the array and delete the record using the ID until the array length is zero.
Works, but is slow and not smart.

Is there a better way to do this?

Regards Chris

Hi @ChrisF

What is the expected maximum amount of records (in your case loop cycles)?

Hi Thorsten,
around 50 parts max at the moment, but for other order pickers the part list contains up to a hundred articles

Regards Chris

This is always a sign that looping is no longer a good idea (in TULIP).

To be honest, I’m not the biggest fan of the looper widget.
For loops with not to many cycles, I prefer a Array (e.g. your array with all the ID’s) and a Loop Step:

  • On step enter → if array not empty → pop from array → do the action with that value → goto loop step (itself) …
    If the array is empty go to next or previous step…

If you tend to reach to many cycles for that practice, It becomes a problem. I don’t know an intended solution yet.
Did you consider to build a looper widget exactly for this single purpose?
So the widget loops and deletes the records? This could be much more performant…
But I dont know how the API handles 100 deletion responses in less than a second or so…
Maybe you need to delay each cycle as well (the looper widget delays each cycle on purpose…)

1 Like

I will talk with my “private” Tulip developer expert in Germany on Monday about this.

Regards Chris