Simplified situation:

  • A view includes fields first_name and last_name.
  • first_name is marked "Exclude from display".
  • last_name has the label Full name (which becomes the column heading in the view).
  • last_name has "Rewrite the output of this field" checked and the rewrite text [first_name](space)[last_name].
  • last_name has neither "Hide if empty" nor "Hide rewriting if empty" checked in "No Results Behavior".
  • Records with both first_name and last_name or only last_name show properly in the Full name column.
  • Records with only first_name (i.e. empty last_name) show nothing.

Seems Drupal should rewrite the field for records with no last_name to show first_name since there is a specific "Hide rewriting if empty" checkbox that is not checked. Is this expected behavior? Or might there be a module interfering with things?

  • I think there's another "Hide Empty Fields" setting under Format settings.. Try there. Mar 30, 2017 at 16:58
  • Thanks for your reply @Niall Murphy. I'm not sure where the "Format settings" you refer to are ... which may be part of my problem! Mar 30, 2017 at 21:40
  • I mean the settings for "Unformatted" or "Table" etc. But I'm not sure about the setting as I'm not near a computer. Mar 31, 2017 at 2:15

2 Answers 2


Although I don't understand why Drupal doesn't behave as I posit in my original question, I have found a solution. It is to use [first_name] as the No results text. If the last name is empty, the no results text is used, and the first name is displayed. If the last name is non-empty, the rewrite results are used, and the first and last names are displayed. Kind of roundabout, but it works.


It would be hard to debug without having access to code.

Can you please try the following.

  • Add two fields first_name and last_name
  • Both fields should be marked as exclude from display
  • Both fields should have Hide if empty and Hide rewriting if empty
  • Add a new field Global: Custom Text (Full name)
  • Rewrite the field to include first_name and last_name

Let me know how you go.

  • Thanks for this suggestion @Ash U. To simplify, I omitted the fact that I'm using Views Data Export with this view. I tried using a Global field, but Views Data Export ignores Global fields when it exports, so that solution doesn't seem ideal for me. Mar 30, 2017 at 21:43

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.