D7 Views: Rewrite multiple field into one with custom separators This is a follow-up to a recent question of mine, that was solved easily. The construct is very similar, but this time I need to add conjunction characters (in my case a comma and a space: ", ") when rewriting the field.

Here's the setup: In a node type, I have three fields: (1) methods, (2) geography, (3) keywords. All three fields are textareas where comma-separated values are entered. These fields are hidden on normal node view (node type -> manage display), but there is a views block showing these values. 

Now, I want all of the fields' content to appear as a single field with a label with additional commas between. 

An example: a node has the following values (1) methods: "evaluation, regeneration" (2) geography: "Denmark, Germany" and (3) keywords: "rivers, restoration".

If all (or at least keywords) fields are filled, the desired result is easy to achieve in the block:


Methods: no label; exclude from display; no result behaviour: hide if empty, hide rewriting if empty; rewrite results: ", [methods]"
Geography: no label; exclude from display; no result behaviour: hide if empty, hide rewriting if empty, no result output: "[methods]"; rewrite results: ", [geography][methods]"
Keywords: label "Keywords"; no result behaviour: hide if empty, hide rewriting if empty, no result output: "[geography]"; rewrite results: "[keywords][geography]"


For the above example this produces


Keywords: rivers, restoration, Denmark, Germany, evaluation, regeneration


Thus, the required commas (between restoration and Denmark as well as between Germany and evaluation) are added correctly. This also works, if either methods or geography are empty or even both, output looks like:


Keywords: rivers, restoration, evaluation, regeneration
Keywords: rivers, restoration, Denmark, Germany
Keywords: rivers, restoration


Now the culprit. If keywords' field is empty, there are two scenarios.


Both geography and methods are empty, also. Then the whole (rewritten keywords) value is also empty and label is not displayed.
Either or both geography and method have values. Then there is a superfluous comma at the start of the value like


Keywords: , Denmark, Germany
Keywords: , evaluation, regeneration
Keywords: , Denmark, Germany, evaluation, regeneration



The actual question: 
How should I setup the view to avoid this starting comma if keywords' field is empty?

The only easy way I found is to make the keywords' field required so there is always a value present. But I'd like to set it up without marking fields mandatory and without changing the fields' types or widgets.
You could rewrite the output of the field with your comma (but without conditions), then exclude from display and use a global textfield to output the field again with your conditions, so if the field is empty it won't show the comma.