How to concatenate fields in Views with different separators (Settings)? I have 4 fields : lastname, firstname, middlename, suffix

I selected TABLE Format. In the Settings tab, I put all fields together in the first column so I can have them together in one row, but I want the display to be:

Jones, John David Jr

instead I can get

Jones John David Jr

or

Jones, John, David, Jr

In other words, the separator is applied between every field, and I want it applied only after the first.

I tried the UNFORMATTED LIST but that didn't provide me with any way to concatenate.
Solution 1:

As @rooby suggested here are the steps you can follow


Add the fields Last Name, First Name, Middle Name and Suffix to the view in the same order
For the first 3 fields Last Name, First
Name, Middle Name select the option "Exclude from Display" and save.
In the settings of the field "Suffix" check the option "Rewrite
the output of this field" under the section "Rewrite Results".
In the TextArea that gets displayed enter [field_last_name],
[field_first_name] [field_middle_name] [field_suffix]


For the exact field names you may click on the link "Replacement Patters" below the text area.

This approach works fine if the Suffix field is a required field and all the records for it. If not the complete value is not displayed if the suffix is empty.

Solution 2:


Add the fields Last Name, First Name, Middle Name and Suffix to the view in the same order
Add "Global: Custom text" field to the view at the bottom of all the fields.
For the fields Last Name, First Name, Middle Name and Suffix select the option "Exclude from Display" and save.
In the settings of the custom text field enter [field_last_name],
[field_first_name] [field_middle_name] [field_suffix] under "Text" and save
Look at the replacement patterns for the exact field names in your system


This approach works fine even if there are empty values for any of the fields.