How can I get a table below using DataView?

I want get a tabel like below:
time progress question
2025-02-01 jingdu a1 wenti a1
2025-02-03 jingdu a2 wenti a2

note 2025-02-01 :

Customer

[[Customer A]]

  • progress::jindu a1
  • question::wenti a1

[[Customer B]]

  • progress::jingdu b1
  • question::wenti b2

note 2025-02-03:

Customer

[[Customer A]]

  • progress::jindu a2
  • question::wenti a2

[[Customer B]]

  • progress::jindu b2
  • question::wenti b2

Customer B and Customer A are independent md files.

my query is

TABLE WITHOUT ID "<nobr>" + file.link + "</nobr>" AS 日期,progress
FROM [[Customer A]] 
FLATTEN list(filter(file.lists, (x) => meta(x.section).subpath="Customer A").text) as progress

How can I get two columns ( progess and question )?

The following is untested and written in the middle of the night:

```dataview
TABLE WITHOUT ID 
  "<nobr>" + origin[2] + "</nobr>" AS 日期, 
  nonnull(rows.itemProgress)[0] as progress,
  nonnull(rows.itemQuestion)[0] as question
FROM [[Customer A]] 
FLATTEN file.lists as item
FLATTEN item.progress as itemProgress
FLATTEN item.question as itemQuestion
FLATTEN meta(item.section).subpath as itemHeader
WHERE string(itemHeader) = "Customer A"
GROUP BY [file.name, itemHeader, file.link] as origin
```

The idea is to make groups based on each section in a file (allowing just one question per customer per daily note), and then use a little trickery to pull out the fields from the resulting rows lists.

Hopefully I’ve not made too many small typos, but the logic should be sound. A little worried whether the header being a link is causing any issues. If I get around to it I’ll test it during the day (at least 5-6 hours from now).

FLATTEN list(filter(file.lists, (x) => meta(x.section).subpath=“Customer A”).text)

1 Like

It works,too amazing.
I’m new to Obsidian, I originally thought that JavaScript was needed to solve this problem.
You’re so professional. Thank you very much. I need to study your code carefully. Later, I’ll add tags to classify the customer diaries, and then output the customer information of specific types.

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