Show Field Label when it has no value

Hi is there a way to display a column label via the Fields Content if the column does not contain a value?

You could create an if-then-else column, something like:

  • If value is empty, then ā€œNot setā€
  • Else value

And then use that column in place of the value in the fields component

1 Like

@Darren_Murphy thanks but does that mean creating a duplicate if-then-else column for every column if any column may be empty?

Yes, it would.
So if you have lots of them then itā€™s probably not a great solution.

Iā€™ve not used the fields component much. Iā€™ll have a look at it and see if there is a better option.

@Scotttiey - I just had a quick look, and now I can see why I donā€™t use it. Itā€™s not very flexible, and you canā€™t assign actions. Fine for a handful of columns, but not the best choice for any more than that.

How many columns do you have?

Iā€™d probably look to use something else, depending on what you need it to look like. Maybe a markdown table in a rich text component, or even coerce the columns into a list that could be used in a collection.

1 Like

Usually what I do is a rich text component, powered by HTML that I generated from JavaScript. That gives me the ability to be flexible in cases like this.

However, you would need to combine all the info needed into a template column first.

Seems like overkill for a no-code platform :sweat_smile:

1 Like

If only we have some sort of a basic table component for Pages, then my life would be much easier.

The final product from the process above looks somewhat like this.

1 Like

Yeah, HTML is my choice for tables as well. Although I didnā€™t suggest it in this case as I could see the opening to a rather deep rabbit hole looming :wink:

Iā€™m just curious - why would you use JavaScript to generate HTML? Is that to apply inline styling, orā€¦? :thinking:

I have a list of info with some fields that can be empty. In some cases, I donā€™t want to generate empty ā€œrowsā€ for fields that have no value, or in some cases clients tell me to make them ā€œTBDā€ for example.

With a template column and JS to handle an array I created from splitting the template column, I can be flexible on what to do with those empty values.

Also, wish the JS column allows more input variables :sweat_smile:

1 Like

Pass it a JSON object, and then use JSON.parse() to unpack it. Then you can have as many variables as you want :wink:
Thatā€™s what I do with that Audit Log concept.

1 Like

I agreeā€¦the Fields component doesnā€™t cut it.

1 Like

Yeah, but still have to pack it into a template column first haha.

Find it strange that this is missing. It creates a bad UX experience. A toggle option would be great on Fields, ā€˜Show label if column emptyā€™ as at least that gives users the option

3 Likes