No Results Behavior on Fields

Learn about the different types of behavior if a field has no results.

We’ll cover the following:

  • How to display text if field has no results.
  • How to hide a field if no results are returned.

Transcript

Trainer (00:00):
We’ve looked at how to customise the field values within a view. Now, I want to show you what you can do if a field has no values because you can customise the behaviour of a field, if no results are returned. So let’s go ahead and edit the tags field. Then click on, no results behaviour. From this whole section, you can configure what the field will do if no results are returned. If a field returns no results, then anything entered into this text area will be displayed instead.

Trainer (00:33):
Let’s test it out. Enter, no tags, into the text area, then click on apply. And if we down to the preview section, we can still see the tags and that is because these articles still have tags. But, if we edit the first article and remove these five tags, and then go back to the preview section, we can now see the label, which is tags, but we can also see the words, no tags, because the field has no values. But if we take a look at the next article, we can see the label tags and also the single tag value. This is useful for situations where you want to tell the end-user that the field exists, but has no values.

Trainer (01:24):
Now, if you want to fully hide the field, if no results are returned, then all you need to do is this. Let’s scroll back up to tags, then click on, no results behaviour, and let’s remove no tags from the no results text, text area. And then simply check, hide if empty, then click on apply. Then if we take a look in the preview section and you can see that the tags field is no longer visible on the first article. If you want to fully hide the field, if no results are returned, then use this option.

Trainer (02:00):
Now you may have a situation where the field is hidden but the label is still visible. If that’s the case, then you may have to adjust the row style options. To do that, scroll all the way to the top, to the format section, and then click on settings on the show row and you may have to adjust the hide empty fields checkbox. For some row styles, this has to be checked. But for others, it doesn’t have to be. Let’s go back to the no result behaviour on the tags field.

Trainer (02:34):
If you have an integer or number field, and you want zero to be declared as empty, you can configure that by checking this check box. Count the number zero as empty. Then at the bottom of this section, we have hide rewriting if empty. This will hide any custom overrides or rewrites, if the field is empty.

Scroll to Top