1

I'm using the Views module to build some views for our company's locations and employees. What I've got set up is: when a user looks at a page for one of our locations, they get a list of employees there. The 'Employee' content type is set up with separate fields such as "Last Name", "First Name", "Middle Init" and so forth.

What I want to do is to find a way to combine these fields in a single line that forms a link to the employee's profile when clicked.

I've found I can do this by changing the "Title" field to something like "Display Name" and adding that field to the view (as the title field gives you the option to link back to the original content), but I'd really rather do it the other way as the data for the content type is imported and I'd rather not sift through all that to add a "Display" field and everything that goes along with it.

Any ideas or am I out of luck?

1 Answer 1

3

You can add the 4 fields in this order:

nid
first name
middle name
last name

For the first 3 fields, check the "Exclude from display" checkbox.

For the 4th field, in the rewrite results section, check the "Rewrite the output of this field", then in the "Text" text area use the replacement patterns for the other fields to join them together.

It will be something like this:

[field_first_name] [field_middle_name] [field_last_name]

Then also check the "Output this field as a link" checkbox and for the "Link path" you can again use the replacement patterns (expand the fieldset to see the available replacement tokens).

It will be something like:

node/[nid]

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.