Ayende @ Rahien

Unnatural acts on source code

Rhino ETL: Aggregates

SoWell, that turned out to be really simple. Check out a simple RowCount:

transform CountRows:
	Context.Items.RowCount = 0 unless Context.Items.RowCount
	Context.Items.RowCount+=1
	RemoveRow()
	OnComplete:
		SendRow( Row(RowCount: Context.Items.RowCount) )
 

And then we have a more complex one, summing two columns:

transform CalcSumOfSalaryAndId:
	unless Context.Items.IdSum:
		Context.Items.IdSum = 0 
		Context.Items.SalarySum = 0
		
	Context.Items.IdSum+=Row.Id
	Context.Items.SalarySum+=Row.Salary
	RemoveRow()
	
	OnComplete:
		SendRow( Row(
			IdSum: Context.Items.IdSum, 
			SalarySum: Context.Items.SalarySum
			) )

 

 So, basically we have an initialization section, processing, and when all the processing is done, you can send new rows downward in the pipeline.

Comments

No comments posted yet.

Comments have been closed on this topic.