Table Interactions

Hey All,

Looking for some help on Table interactions. I was curious if there was a way aside from using record placeholders to make this happen. I have three tables an inventory table, work order, and a traceability table. When I complete the work order (with a trigger) I would like for all the records that were loaded into the traceability table for a specific work order id to be deducted from the inventory table in mass. Right now I have a separate app that can do this one by one but that is pretty manual. If someone has figured this out that would be great. Currently I do have a unique inventory ID that I am using to “link” the records in each table.

@mikeg the way I’ve done this in the past is by using looping. Generally speaking, it should be pretty straightforward to get a list of the record IDs that need updating. You may want to perform some operations based on a QTY per field in a different table, as well.

The way this has worked, historically, is to use the looping technique. Here is a video of how that works.

You might also find this material backflushing app from the library useful, as it is very similar to your use case: https://tulip.co/library/apps/material-backflush-system/

In that example I think we may be using the Table API to get the affected records, since it was created before linked records.

Finally, with the release of custom widgets you can actually just loop directly, which makes things much easier. That widget is not yet released to the public but if you’d like it I can put it on your instance.

Does this help?

I believe so! I think you have given me more than enough information to make this work. If you could add that new widget that would most appreciated. I will mess around with what I have currently, do some testing, and reply with a follow-up. Thanks again.

A loops custom widget?

1 Like

@youri.regnaud it was one of the first custom widgets I just had to make. It allows you to loop through as many items as you’d like.

I’ve actually made two versions, one that iterates on an array and one that does something on a counter. I’ve attached an image of one of the first versions that works on an array. We did add a slight delay (200ms) just to give the server a bit of a break.
looper new

Anyway, the library team is going to be releasing it soon after cleaning up some of my janky code and making a comprehensive unit test app to go along with it.

This method is way easier than reloading a step and since the triggers aren’t happening in series (they happen one after the other, independently) there is no limit.

1 Like

once library team release it , I will have a try

1 Like