Adding a sequence

Hi,

I want to do the following :

  1. read from csv file
  2. order by first field
  3. add a sequence number to the rows, breaking on first field (I mean number the lines and start over for each new first field)
  4. output to database

Obviously, all steps are easy to do, but step 3. So am I missing something, or should I write my own “add sequence” component ?

Franck

Ok, in this case, use sort component first to get together records with the same key and then in reformat just check when the value of the key field changes and increase internal counter.

David.

I’m not sure, but if you want numbering records with same key, you must use reformat component and write this funcionality in transform code. Sequence in this case is unusable.

I am not quite sure that I understand what you need to achieve, but Clover has persistent Sequences which may be used for something like numbering records.

Sequences works similarly to database sequences. Each call to next() generates new unique number. Actual value is stored on disk, so it is quarantedd to generate unique numbers.

If you use CloverGUI, sequences can be defined there quite easily.

CloverExamples package contains example/demo graph which uses sequences.

David.