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

28 views
Skip to first unread message
Message has been deleted

Owen Stephens

unread,
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:
and(isNonBlank(cells["FirstNames"].value)),isNonBlank(cells["LastName"].value))

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

Owen
On Monday, November 7, 2022 at 9:57:45 AM UTC tihana...@gmail.com wrote:
Hi! 

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
Forward
0 new messages