openrefinegoogle-refine

Progressive number in Openrefine column


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.


Solution

  • 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