Sequence object generates series of numeric information. They are able to store their state after the graph execution has finished. To achieve this functionality, every sequence is bounds to a binary file stored in filesystem. CloverETL designer provides wizard/editor for definition of sequence attributes:
All attributes except current value are editable. When creating a new sequence, its current value is set to start value. When modifying an existing sequence, you may reset its value to start value.
CloverETL engine supports graph-local definition of sequence objects. However you may use the same file among multiple graphs to share sequence's value in them (other parameters of sequence may be modified). When a graph is using a sequence, the file will be locked, thus concurrent usage of simple sequence is not possible.
Xml definition:
<Global> ... <Sequence id="Sequence0" type="SIMPLE_SEQUENCE" fileURL="sequence.dat" name="seq" start="1" step="1" cached="5" /> </Global> <Node id="REFORMAT0" type="REFORMAT"> <attr name="transform"> import org.jetel.component.DataRecordTransform; import org.jetel.data.DataRecord; import org.jetel.data.GetVal; import org.jetel.data.SetVal; import org.jetel.data.sequence.Sequence; import org.jetel.graph.TransformationGraph; public class reformatOrders extends DataRecordTransform { Sequence sequence; public boolean init(){ sequence = this.graph.getSequence("Sequence0"); return true; } public boolean transform(DataRecord source[], DataRecord[] target){ try{ // OrderKey gets its value from sequence SetVal.setInt(target[0],"PRODUCTID",sequence.nextValueInt()); }catch(Exception ex){ return false; } return true; } } </attr> </Node>