How to filter every other row

Hello,
I am very new to CloverETL, so please excuse my ignorance.

I am attempting to filter out every other row from a csv, then count how many rows have an item in a certain field.

Does anyone have any suggestions on how to go about this? The main issue is filtering out the even rows.

Thanks

Hi welshed2,

for filtering every other row you may use Reformat with code like this:


//#CTL2

boolean ignoreThis = true;

function integer transform() {

	//toggle state
	ignoreThis = !ignoreThis;
	
	if (ignoreThis) {
		//filter out
		return SKIP;
	} else {
		//copy input record to output	
		$out.0.* = $in.0.*;
		
		//send output
		return ALL;
	}
}

For counting rows according to some field value: first filter out “good” rows using http://doc.cloveretl.com/documentation/ … ilter.html and then count them using http://doc.cloveretl.com/documentation/ … egate.html

I hope this helps.

Perfect! Thanks so much for your prompt reply.