@ahansson89 - my bad - I meant coalesce , but since I was only testing to see that the rex code worked, I didn't notice my brain had used the wrong c verb.
Actually, come to think of it, concatenate would work just as well, since all the other fields would have to be null anyway for your specifications to be right, and concatenating a bunch of nulls together with a single value would result in the same as the original value.
If there is a possibility that more than one of the fields will have a value, and you want to retain the multiple values, then use the same code as above with mvappend .
... View more