14

I have a view set up to use the unformatted list type. I'm pulling in about 10 different fields, but would like to concatenate two of them onto a single line in the display. Is this possible?

Example: fields are Content: Session Number, Content: Title, Content: DateTime, Content: Speaker. Right now, all of them render onto separate lines. I'd like for the Session Number and Title to be concatenated onto a single line, so I get S3 | My Session Title.

  • this could also be done using fields setting under Format tab see Fields: Settings , after clicking this you will see a popup, now simply check the fields under inline option. – WaQaR Ali Nov 4 '15 at 7:58
27

Let's say you have field A, and field B.

  1. Make sure A, comes before B in the fields list.
  2. Edit field A, and check "Exclude from display". The field will now no longer show up.
  3. Edit field B, find the checkbox for "Re-write the output of this field".
  4. Below the new textbox, find "Replacement patterns." There you should now be able to find something that looks like [field-A], and [field-B], with possibly many more options.
  5. Enter "[field-A] [field-B]" as the replacement pattern.

And you should have the fields concatenated.

There are some situation, where the markup generated by Views with this configuration is not desirable, as you will now have A "inside" B. If that's a problem, one can add a completely new dummy field, of type "Global: text", and to steps 3, 4 and 5 on that field instead.

  • 2
    Yes, I've found that more comprehensible to exclude both field A and B, and use a new dummy field to concatenate them together. – Johnathan Elmore May 25 '12 at 17:35
  • +1 upvote question and this answer - great stuff - I found this works, too. And if you want the resultant field to be linkable, you can use the Content: Path and use this as a token in the Global: text field's rewrite settings. – therobyouknow Mar 13 '14 at 13:47
  • @Letharion How can concatenate two filed and display in node? – Yama Nov 8 '14 at 15:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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