Recipe:
Given this truncated sample data:
Assuming that there are more entries that aren't being shown, if I only want to join the two subject headings in Column 4 for Ammanati, Bartolomeo:
- Make sure you're in the row view before you proceed
- Add column based on any column, with whatever name (I'm calling it index), and "" in the Expression box.
- Edit the very first cell in index, put in a placeholder value. (NOTE: put in one placeholder value only, doing two won't work.)
- Move index to the first column position.
- Switch to record view. (Note : this appears to be optional in Open Refine 2.9, but you may need to do it for older versions.)
- Because I found it hard to read recipes with other people's column names, I am referring to Column 2, as the <test column>. (Since this is the column you use as the test condition for the if statement). Column 4 will be referred to as the <edit column>, to indicate which column I want to edit.
- Transform on <edit column> : if(cells["<test column>"].value.contains("Ammanati"), row.record.cells["<edit column>"].value[rowIndex] + ";" + row.record.cells["<edit column>"].value[rowIndex+1], value)
- Transform on <test column> and create a placeholder row: if(row.record.cells["<test column>"].value[rowIndex-1].contains("Ammanati"), "place", value)
- Switch to row view.
- Custom text facet on <test column>: value.contains("place"), select true
- Star the placeholder rows.
- Remove the custom facet and facet by star
- All->edit rows->remove matching rows.
- Remove the index column.
Long, detailed explanation: