Thanks to this StackOverflow question, I finally found a great use case to introduce the columnName variable in OpenRefine.
The columnName variable has been poorly documented (see previous discussions in SO and on the OpenRefine mailing list). The feature got really interesting with the All > Transform option available in OpenRefine 2.7 back in 2017 (yes, this blog post is long overdue!)
The columnName variable lets you inject the name of the column where the GREL expression is run automatically. It is useful when we want to fill down multiple columns when you are in record mode. The GREL expression to fill down is row.record.cells[columnName].value[0]
Here is the video tutorial I recorded for the StackOverflow question.
The trick here is to fill down the first column last (so you do not lose your records when filling down other columns). This is possible by simply reorganizing the order of column in the modal Select Column see screenshot below:
Using columnName in tutorials
In some more recent tutorials, you will note that I start using the columnName variable when writing the GREL expression. Like this, you can copy-paste the expression, and it will work in your project regardless of the column name!
Do you have other usages in mind for the columnName variable? If so, please share them in the comment below!