Build from 2 source bases a new base

I am trying to build from two source tables a third table, that holds iterated information of both tables.
I should like to accomplish it with selecting from multi select menu’s and pushing a button to generate the third table.

I didn’t get it working with “Sequence” and “Nth” in the formula, and it would be great if it could be explained the logic in more detail, thanks in advance.

Thanks in advance for your support

Hi @Jean_Pierre_Traets ,
I started to make some basic implementation in your doc, but it’s not entirely clear to me how an order can be consistent.

In my opinion, an order is made of item and components, therefore I’d expect to see it on the Order table.
Said that: Do all orders should have all the selected components?
Or they can be treated individually?
I followed the second approach, but you tell me otherwise.

Finally, you don’t need to go through a Sequence() because you already have a list
(have a look at the button implementation).

Main difference between the two:

  • Sequence() generates a list of - well - sequenced numbers.
  • FormulaMap() allows you to iterate through a list of objects.

Please, let me know if this helps.
Cheers!

1 Like

Dear @Federico_Stefanato, thanks a lot picking up my question.

I realize that my chosen wording is not the best, probably because it’s an extract of something bigger.

In the orderDB each row is an item, all have the same style, color only the size differs.
Yes you are right, each item from a same style will get the same components. (from where the item is build up)

The reason I want to execute in steps, has to do with production specifics/dynamics.
When cutting fabrics, the fabric will be put in layers and the fabric has one color, but different dye lots, and as you can imagine, one garment’s components needs to exist from one and the same lot.

The reason it has to go from a orderDB to productionDB is;

  1. You need to produce more pieces (Items) to be able to deliver
  2. You need to be able to follow each component individual. Maybe you T-shirt has a print on the front panel and has been outsourced to a printing house and when you get it back it needs to go to the same color lot not to have shading with the other components.
  3. When all components are stitched, they become an item (garment), so production is a kind of helper table to be able to follow the stages of the production and coordination of it’s logistics.

My aim is to choose from both multi select menus the combination to be generated and with one button to execute the process.

Will that be possible?

This just to avoid having a doc full of single time used buttons as it will never be used afterwards.

Hi @Jean_Pierre_Traets,
Sure this is possible.

This is the button implementation:

[Orders Selected].Filter([Sent To Production].Not()) // take the orders from the list and filter-out the ones already processed
  .FormulaMap(CurrentValue.WithName(order, // Iterate on each order...
        RunActions( // do the following actions: 
          [Components Selected].FormulaMap(CurrentValue.WithName(component, // select all the components from the select area
                  ProductionDB.AddRow( // add a new row on Production table
                      ProductionDB.P_item,order.O_item,
                      ProductionDB.o_QTY,order.oQTY,
                      ProductionDB.Component,component
                    )
                )
            ),
          order.ModifyRows(OrdersDB.[Sent To Production], true()) // set the flag on the just processed order
        )
      )
  )

I hope this clarifies a bit.
Tell me otherwise.

Cheers!

2 Likes

Dear Federico,

Impressive and very clear how you build the solution, including the checkbox in the OrderDB becoming “true” when the selected ones have been moved in the ProductionDB and the detailed explanations.

When I see your solution it immediately clear what you are doing.
Thanks giving me the opportunity to learn, and with some more practice I will be able to get there myself. :footprints: :footprints: :footprints:

Hopeful Coda will give you the time slots to continue adding your valuable input to the community

2 Likes