4

Is it possible to generate a "counter", a progressive number in a column using GREL?

For example, I would like to add value to that number to generate an identifier for each record.

Aubrey
  • 507
  • 4
  • 20

1 Answers1

5

Each row in an OpenRefine project has an index - a sequential number starting at zero (the first row in the project).

You can access this using 'rowIndex'.

To combine this with a value (I'm assuming the 'value' is a string) to create an row identifier I'd suggest:

From the column containing the value you want to use click the dropdown at the top of the column and choose 'Edit Column'->'Add Column based on this column' In the dialogue that appears give the new column a name (e.g. Row ID) then enter the following in the 'Expression' box:

rowIndex+value

Then click 'OK' and you should have your row identifier column

Owen Stephens
  • 1,550
  • 1
  • 8
  • 10