Use two different front matter variables for one column in the table? #826
Replies: 6 comments 7 replies
-
hi @ReaderGuy42, would the `choice() function work for you? if I understand your problem correctly, you could use it to do the equivalent of "if there is TotalLength, then show TotalLength, otherwise show TotalPages". If I was you I would check that up in the dataview docs and see if it works as a workaround. |
Beta Was this translation helpful? Give feedback.
-
Thanks! However, there's some sort of error that I don't understand (see screenshot). It's expecting something, but even if I add a comma or anything it still doesn't work. |
Beta Was this translation helpful? Give feedback.
-
It may be a problem with the first part of the choice. Try correcting Total
Pages to TotalPages.
Le jeu. 3 févr. 2022, 09:47, ReaderGuy42 ***@***.***> a
écrit :
… Thanks! However, there's some sort of error that I don't understand (see
screenshot). It's expecting something, but even if I add a comma or
anything it still doesn't work.
[image: image]
<https://user-images.githubusercontent.com/71895400/152309511-9cef147d-d770-4175-8f3b-2cbcf904cb3b.png>
—
Reply to this email directly, view it on GitHub
<#826 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOF6WQDWASZDYLTJV7NM25DUZI6J5ANCNFSM5NGQ3BDQ>
.
You are receiving this because you commented.Message ID:
<blacksmithgu/obsidian-dataview/repo-discussions/826/comments/2102138@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
```dataview
TABLE name, choice(TotalPages != null, TotalPages + " pages", TotalLength +
" minutes") AS "Length"
FROM #books or #audiobooks
```
Le jeu. 3 févr. 2022, 13:05, ReaderGuy42 ***@***.***> a
écrit :
… Ok, yes, now it outputs the table again! But now the value for each book
for Length is "null pages". Any ideas on that? Thanks :)
—
Reply to this email directly, view it on GitHub
<#826 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOF6WQCXR57MSZ7EHJUY6LDUZJVOXANCNFSM5NGQ3BDQ>
.
You are receiving this because you commented.Message ID:
<blacksmithgu/obsidian-dataview/repo-discussions/826/comments/2103269@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Yes it is possible using something like... dateformat(field, hh:mm)
But I don't know exactly off the top of my head. Check the dataview docs
and the date program that it uses Luxom I think it is called.
Le jeu. 3 févr. 2022, 14:02, ReaderGuy42 ***@***.***> a
écrit :
… Hey, fantastic thank you! That works :) Just one last thing, is it
possible to somehow format the numbers? So I put TotalLength: 7.25h and I
get out 07:15:00.000 minutes. I don't need the seconds or all the digits
after the period. Is it possible to remove this?
Thanks :)
—
Reply to this email directly, view it on GitHub
<#826 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOF6WQF4RXJLGKEYWLSZWMDUZJ4FPANCNFSM5NGQ3BDQ>
.
You are receiving this because you commented.Message ID:
<blacksmithgu/obsidian-dataview/repo-discussions/826/comments/2103582@
github.com>
|
Beta Was this translation helpful? Give feedback.
-
Perhaps you could search the discord or forum for tips on how others have
used it. Sorry I am not very good at it so can't help.
Le jeu. 3 févr. 2022, 17:03, ReaderGuy42 ***@***.***> a
écrit :
… Does anyone else happen to know about this, as I can't find anything
beyond dv.time and I can't get that to work. Thanks :)
—
Reply to this email directly, view it on GitHub
<#826 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AOF6WQB7DCO3VXI6KDBZKN3UZKRORANCNFSM5NGQ3BDQ>
.
You are receiving this because you commented.Message ID:
<blacksmithgu/obsidian-dataview/repo-discussions/826/comments/2104884@
github.com>
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a setup for keeping track of my reading progress, and one folder and a dataview table is for "Currently Reading", which includes a progress bar (see below for code block). I have two variables that are essentially the same thing, one called "TotalLength" which is for audiobooks, and one "TotalPages" for regular books. The reason I have these separately, and not something just like "Total" is that I'm also using the Tracker plugin for which I haven't been able to find a better solution to filter certain entries, depending on the medium, so I'm using this variable to output depending on if it's a book or audiobook.
However, this means that I either have two different dataview tables, one for each of these media, or one table with two columns for time and pages respectively. The reason I don't like this is a) that for any one book it will only need one of those two columns so the other will be empty, and b) since there's really only one required, I'd like to find a way to sort of combine these two columns. Is this possible somehow?
Thanks :)
Beta Was this translation helpful? Give feedback.
All reactions