Help with Dataview table and null

I have a simple dataview table I am using in my each book note to pull some of the metadata information to the top in the table above the book cover. Sometimes my book doesn’t have a series and since I am querying the series and the number in the series I will get null, null. How do I make it render as blank.

TABLE Without ID
	Author AS "Author",
	join(list(Publisher, booknumber), " #") AS "Publisher",
	join(list(series, seriesnumber), " #") AS "Series",
	Read,
	Rating
where file.name = this.file.name

Go to the dataview plugin settings; under “View Settings” there is a configurable option called “render null as…”; there, you can insert for example \- - in this case, if no series exists, the output would simply be a dash which certainly looks nicer!

1 Like

So I tried that and it works except for places where I use join. Those still give me null, null

About this you need to clarify some things:

  • if you have Publisher you have also booknumber?
  • if you have series you have also seriesnumber?
    If yes for both, then you can try this query:
TABLE Without ID
	Author AS "Author",
	choice(Publisher, join(list(Publisher, booknumber), " #"), " ") AS "Publisher",
	choice(series, join(list(series, seriesnumber), " #"), " ") AS "Series",
	Rating
where file.name = this.file.name

If not, things becomes more complicated…

EDIT

ok, if the second case, try this one:

TABLE Without ID
	Author AS "Author",
	default(Publisher, " ") + choice(booknumber, " #" + booknumber, " ") AS "Publisher",
	default(series, " ") + choice(seriesnumber, " #" + seriesnumber, " ") AS "Series",
	Rating
where file.name = this.file.name

So, publisher is a bit of a misnomer because it’s really more like publisher series. Sometimes there are numbers and sometimes there are not. It’s the same with the series. Thank you for your help. You have really helped me out with both questions.