How do i remove these empty rows (dataview)?

What I’m trying to do

Removing the empty rows that has no values under defined headers

Things I have tried

I tried flatten but didnt work.

TABLE WITHOUT ID
    join("# [[" + (file.name + "|" + upper(dateformat(file.day,"cccc dd/MM/yy")))  + "]]") as files,
    "`$= dv.taskList(dv.page(\"" + file.name + "\").file.tasks
        .where(t=> !t.completed
        && t.status.includes('?')
        && t.section.subpath.includes(dv.current().outcome)
        && t.section.subpath.includes('Project tasks')),  
        false)`" AS back-log,
    "`$= dv.taskList(dv.page(\"" + file.name + "\").file.tasks
        .where(t=> !t.status.includes(' ')
        && !t.status.includes('?')
        && t.section.subpath.includes(dv.current().outcome)
        && t.section.subpath.includes('Project tasks')),  
        false)`" AS completed
FROM 
    "Periodic notes/01 Daily notes"
FLATTEN 
    join(dateformat(file.day, "yyyy-'W'WW") + " Project (" + this.outcome + ")") as weekYear
WHERE 
    file.tasks AND contains(weekYear, this.file.name)

I’ve not seen that combination of queries before, but I can tell for sure that the rows of the table are decided upon before the dataviewjs executes.

So I need to ask whether you need to complete tasks from this view, or is it just for presentation?

If the latter, I would rather use list(filter(file.tasks,...)) as completed & co, which would allow to check the length before presenting the row.

If you are going to keep that combination of queries you’d still need to use some filter variant in the table query to determine whether to display the row or not.

Does this make sense? Do you know how to build the filter?

Hey, sorry for the late reply. Ill try and make few changes taking consideration to your suggestions. Will update in few days. Thanks man!.

Hey, do you have the time to help me build the filter? I was trying to figure out solutions you proposed, but I’m getting lost. Really appreciate it.

Sorry, it took some time it’s been a busy week, but here is a query which hopefully should do the job:

```dataview
TABLE WITHOUT ID
  link(file.link, upper(dateformat(file.day, "cccc dd/MM/yy"))) as files,
  backlogTasks as "backlog",
  completedTasks as "completed"
FROM
    "Periodic notes/01 Daily notes"
FLATTEN 
    dateformat(file.day, "yyyy-'W'WW") + " Project (" + this.outcome + ")" as weekYear
WHERE 
    file.tasks AND contains(weekYear, this.file.name)
FLATTEN list(filter(file.tasks, (task) => 
  contains(meta(task.section).subpath, "Project tasks")
  AND contains(meta(task.section).subpath, this.outcome))) as projectTasks
FLATTEN list(filter(projectTasks, (task) =>
  !task.completed AND task.status = "?")) as backlogTasks
FLATTEN list(filter(projectTasks, (task) => 
  task.status != " " AND task.status != "?")) as completedTasks
WHERE length(backlogTasks) > 0 OR length(completedTasks) > 0
```

It’s hard to test, and there is one vital difference between your query, and this query, and that is that this query will display the task text, and not an interactive task. But please do test out if this query displays the correct tasks, and removes the empty rows you wanted to remove.

If it does do that, you might re-use the inline queries you used for the backlog and completed columns from your script and the rest from my version, but I must say that I was kind of surprised this combination of multiple queries with both a pure DQL query and those inline queries actually somewhat worked.

Hopefully this should bring you a step closer to your wanted result.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.