This project is read-only.

Grouped Row - Parent Row

Apr 9, 2013 at 7:21 PM
I have a question regarding how to accomplish the following:

My ETL scenario is that I have a collection of sales orders. And within each individual sales order I have sales order lines

i.e. [Sales Order] 1 ---> 1...M [Sales Order Lines]

So an ETL pipeline would be:

Input.From(SalesOrderCollection)
.Many( row => GetSalesOrderLines(row))
.DbCommand(Target_DB, UpdateSalesOrderLine)
.Execute();

Now when all the sales order lines have been updated for a Sales Order I want to then update the Sales Order. My question is once I've filled the pipe with the Sales Order Lines how can I get back to the original Sales Order row so I can update it (just once) when all the sales order lines associated with it have been updated?
Apr 9, 2013 at 8:21 PM
Something like the following should work :

var orderPipe = Input.From(SalesOrderCollection) ;

orderPipe.Many( row => GetSalesOrderLines(row))
.DbCommand(Target_DB, UpdateSalesOrderLine)
.Execute();

orderPipe.DoSomeThingElse()
.Execute();

If you want to traverse the sales pipeline only once you could call Execute at the end, like this :
var orderPipe = Input.From(SalesOrderCollection) ;
orderPipe.Many( row => GetSalesOrderLines(row))
.DbCommand(Target_DB, UpdateSalesOrderLine) ;

orderPipe.DoSomeThingElse();

orderPipe.Execute();