Split one record in two different record

hello

i want to split my input in two different out put and also reformat it.

how to get this done.

currently i have try by reformating but its not working

reformat class generate exception out of index for target[1]

if i remove all line with target[1] then graph shows Fatal_Error in outout2

here is sales.txt











here is time.txt







here is salesout.txt













here is graph file.

<?xml version="1.0" encoding="UTF-8"?> 0 and sv.current\_version and sv.sales\_representativ=em.id and em.person\_master\_id=pm.id and sd.sv\_id=sv.id"/> import org.jetel.component.DataRecordTransform; import org.jetel.data.\*; import java.util.Date;

public class reformatOrders extends DataRecordTransform{

int counter=1;
int field=0;

public boolean transform(DataRecord source, DataRecord target){
try{

// mapping among source + target fields
// some fields get assigned directly from source fields, some
// are assigned from internall variables
Date saleDate=GetVal.getDate(source[0],“date”);
SetVal.setInt(target[0],“time_id”,counter);
SetVal.setInt(target[0],“day”,saleDate.getDate());
SetVal.setInt(target[0],“month”,saleDate.getMonth()+1);
switch(saleDate.getMonth()+1)
{
case 1:
SetVal.setString(target[0],“month_name”,“January”);
SetVal.setString(target[0],“quarter”,“Q1”);
break;
case 2:
SetVal.setString(target[0],“month_name”,“Fabruary”);
SetVal.setString(target[0],“quarter”,“Q1”);
break;
case 3:
SetVal.setString(target[0],“month_name”,“March”);
SetVal.setString(target[0],“quarter”,“Q1”);
break;
case 4:
SetVal.setString(target[0],“month_name”,“April”);
SetVal.setString(target[0],“quarter”,“Q2”);
break;
case 5:
SetVal.setString(target[0],“month_name”,“May”);
SetVal.setString(target[0],“quarter”,“Q2”);
break;
case 6:
SetVal.setString(target[0],“month_name”,“June”);
SetVal.setString(target[0],“quarter”,“Q2”);
break;
case 7:
SetVal.setString(target[0],“month_name”,“July”);
SetVal.setString(target[0],“quarter”,“Q3”);
break;
case 8:
SetVal.setString(target[0],“month_name”,“August”);
SetVal.setString(target[0],“quarter”,“Q3”);
break;
case 9:
SetVal.setString(target[0],“month_name”,“September”);
SetVal.setString(target[0],“quarter”,“Q3”);
break;
case 10:
SetVal.setString(target[0],“month_name”,“October”);
SetVal.setString(target[0],“quarter”,“Q4”);
break;
case 11:
SetVal.setString(target[0],“month_name”,“November”);
SetVal.setString(target[0],“quarter”,“Q4”);
break;
case 12:
System.out.println(“case 12:”+saleDate.getMonth());
SetVal.setString(target[0],“month_name”,“December”);
SetVal.setString(target[0],“quarter”,“Q4”);

}

SetVal.setInt(target[0],“year”,saleDate.getYear()+1900);

SetVal.setInt(target[1],“id”,200);
SetVal.setInt(target[1],“customer_id”,GetVal.getInt(source[0],“customer_id”));
SetVal.setInt(target[1],“time_id”,counter);
SetVal.setString(target[1],“doc_no”,GetVal.getString(source[0],“doc_no”));
SetVal.setInt(target[1],“version”,GetVal.getInt(source[0],“version”));
SetVal.setString(target[1],“sales_representative”,GetVal.getString(source[0],“sales_representative”));
SetVal.setInt(target[1],“item_id”,GetVal.getInt(source[0],“item_id”));
SetVal.setString(target[1],“unit”,“MM”);
SetVal.setInt(target[1],“qty”,GetVal.getInt(source[0],“qty”));
SetVal.setDouble(target[1],“price”,GetVal.getDouble(source[0],“price”));
SetVal.setDouble(target[1],“discount1”,GetVal.getDouble(source[0],“discount1”));
SetVal.setDouble(target[1],“discount2”,GetVal.getDouble(source[0],“discount2”));

}catch(Exception ex){
errorMessage=ex.getMessage()+" ->occured with record :"+counter;
System.out.println(errorMessage);
ex.printStackTrace();
return false;
}
counter++;
return true;
}
}







hello david
when next version will out?

Hello !

Your reformat does not work because current version of Reformat (as of Clover release 1.1.6) does
not support more than 1 intput and 1 output ports.

This is going to be changed in the next release (1.1.7) where reformat component will be able to support 1 input and multiple output ports.