I have the following query which works …
dv.table(["When", "!", "Task", "Project", "Mins", "Dodate", "<=today", "not null"],
dv.pages("#week/this OR #week/scheduled")
.sort
(t => t.dodate)
.map(t =>
[t.hour, t.essential, t.file.link, t.project, t.duration,
t.dodate,
t.dodate <= dv.date('today'),
t.dodate !== null
])
)
)
but I want to add a .where
clause based on the last 2 columns.
I only want to include files where dodate
is not null and where dodate
<= dv.date('today')
BUT
.where (t => t.dodate !== null)
doesn’t exclude anything
and
.where (t => t.dodate == dv.date('today'))
excludes everything
(and of course .where (t => t.dodate == dv.date('today') && t.dodate !== null)
also doesn’t work)
I’ve been using DQL up until now so new to Dataviewjs & really appreciate any help.
holroy
February 14, 2023, 1:09am
2
In order for us to help you we need to see at least one example of how the files you’re using are looking. For example I’ve not got the dodate
defined for any of my files.
Do you get any output, in any case of you running this script? Do you get any error messages if trying out those WHERE
clauses?
This is what I get with no where clause. With a where clause I get headings but no rows.
dodate is metadata in format YYYY-MM-DD - eg. dodate:: 2023-02-14
Appreciate your help
I solved it. By changing the order of the .where, .map & .sort clauses
dv.table(['When', '!', 'Task', 'Project', 'Mins', 'Dodate', '<=today', 'not null'],
dv.pages('#week/this OR #week/scheduled')
.where(t => t.dodate <= dv.date('today') && t.dodate !== null)
.sort
(t => t.hour)
.map(t => [
t.hour, t.essential, t.file.link, t.project, t.duration,
t.dodate,
t.dodate <= dv.date('today'),
t.dodate !== null
])
)
system
Closed
February 23, 2023, 9:43pm
5
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.