Hi,
I’m attempting to automatically add multiple rows… to two different tables… based upon the relations on a given item. Here’s the structure of tables I currently have:
- Client Product SKUs - each row is a single SKU per client item. One of the included columns is a multi-relation that is associated with the components that make up the item
- components_Client Product SKUs - a table that stores the component “formulas” for each Product SKU. For instance, if sku “ITEM A” is comprised of two components of packaging and two components of product elements, then there will be 4 rows in this table, each relating to the parent Client Product SKU ID.
- POs - log table for purchase orders placed by a client. Contains a multi-relation column with all Line Items related to the PO.
- PO Line Items - log table where each row is single line item of Client Product SKU that relates to the parent PO.
- Packaging Dept Work Items - log table where each row is the component needed in order to produce packaging specific components of related Client Product SKU. (In the above example of ITEM A, there would be a row for “packaging component 1” and a row for “packaging component 2”).
- Product Dept Work Items - log table where each row is the component needed in order to produce product specific components of related Client Product SKU. (In the above example of ITEM A, there would be a row for “product component 1” and a row for “product component 2”).
So what I’m attempting to accomplish here is that when a PO Line Item is added to the PO, there’s a related Client Product SKU associated with that Line Item, which is made up of multiple components. Then I need to somehow loop through the related Client Product SKUs components and if it’s a packaging component, add a new row to the Packaging Dept Work Items table, or, if it’s a product component, add a new row to the different Product Dept Work Items table. But I’m not seeing a way to set this up.
I’m thinking I also may not currently have the tables setup in an optimized way. I originally attempted to have the “Packaging Dept Work Items” and “Product Dept Work Items” tables be combined in one large work items table, and maybe filter the views. However, the additional data needed in those two departments is so different that it ended up being a bit of a mess so I split out.
Either way, I’d still run into the need to loop through the component parts, it would just allow me to add to one big table as opposed to two more organized tables.
Any ideas? Thanks.