Creating column with relative row index for each row of each record

14 views
Skip to first unread message

Paul Smith

unread,
May 12, 2018, 8:19:24 AM5/12/18
to OpenRefine
Dear All,

Consider the following:

RecordID RowInsideID Name
1 1 Paul
1 2 Peter
2 1 Mary
2 2 Jane
2 3 Thomas

Given columns RecordID and Name, how could one create the column RowInsideID, which has for each row of each record the corresponding row index starting with 1 for each record.

Thanks in advance,

Paul

Ettore Rizza

unread,
May 12, 2018, 8:25:58 AM5/12/18
to OpenRefine
Hi Paul,

You must first create records using "Blank down" on your ID column, then use this GREL formula:

row.index-row.record.fromRowIndex + 1

Here is a short screencast.



Cheers,

Ettore

Paul Smith

unread,
May 12, 2018, 9:34:42 AM5/12/18
to OpenRefine
Thanks a lot, Ettore. That works!

Paul
Reply all
Reply to author
Forward
0 new messages