Re: Concatenate 2 columns but if one column is blank leave blank

Skip to first unread message
Message has been deleted

Owen Stephens

Nov 7, 2022, 6:53:34 AM11/7/22
to OpenRefine
There are different ways you could approach this, but I'd probably do it by writing a custom text facet like:

This would give a 'true' value only when both columns are non blank - i.e. you have both a FirstName and LastName value
Apply the 'true' filter from this facet before you do your concentation and you will avoid situations where one of them is blank

Best wishes

On Monday, November 7, 2022 at 9:57:45 AM UTC wrote:

I am new to Openrefine and I have a problem with concatenating two columns (First and Last names). Since some rows in First Names are blank it doesn't recognize anything when I type : 
cells["FirstNames"].value) + " " + cells["LastName"].value

I want to join those 2 columns, but if one column is blank (Names) I would want the output to be also empty (without Lastname). All examples I have found wanted to do the exact opposite (fill the output with the column that is not blank - This is what Joining does.)

Thank you
Reply all
Reply to author
0 new messages