obsidian-dataview icon indicating copy to clipboard operation
obsidian-dataview copied to clipboard

Displaying multiple occurrences of a tag in a list or table

Open Bobw147 opened this issue 4 years ago • 4 comments

First of all I would like to say thanks for such a brilliant plug-in. It has been extremely useful to me so far. Today, however, I came across a use-case that it doesn't appear to handle so I guess this is more of a feature request than a bug report.

I would like to be able to have multiple instances of the data associated with a given tag in the same file parsed and displayed so that each has it's own row in a list or table.

My ideal use-case.

I have a file that contains that a number of sections and in each section I have a tag followed by data that I want to display in, say, a table. Ideally there should be a row in the table for each entry of that tag despite the fact that they are in the same file

For example, let's assume I have

Section 1

#task name:: this task name due-date:: 2021-08-15

Section 2

#task name:: another task name due-date:: 2022-02-10

I would like each of these to have it's own row in the table even thought they are from the same file. What I will get at the moment is a single row containing the data for the entry in Section 2

In fact even if I remove the #task definition from Section 2, what I will see displayed in the table is still the data associated with Section 2! I assume that this is because the parser is triggered by the first occurrence of #task, parses the rest of Section 1 collecting the name and due-date properties but then continues to parse the remainder of the page, comes across the field variables in Section 2 and overwrites those previously obtained. It makes sense that this happens because the parser does not know when to stop processing.

I know I could move the task into different files but I have a situation where it would be useful to keep the items together in the same file.

Perhaps I have missed something. Your thoughts would be welcome.

Bobw147 avatar May 16 '21 20:05 Bobw147

I'm actually working on this as the next major feature, where markdown sections can have their own metadata and you can select per-section, rather than per-file, which I think should be exactly your use case.

blacksmithgu avatar May 16 '21 23:05 blacksmithgu

Not only a brilliant programmer (having been in the industry for 30+ years, I recognise one when I see one!) but with precognitive/clairvoyant abilities as well. I look forward to it. Is it too dangerous to hold my breath just yet?

Bobw147 avatar May 17 '21 07:05 Bobw147

Was this feature implemented @blacksmithgu? Can this be closed?

NomarCub avatar Jun 17 '22 19:06 NomarCub

Section based indexing works now but this specific use case would need DVJS. Obsidian's metadataCache doesn't index metadata that way so we'd have to parse the file.

AB1908 avatar Jun 17 '22 23:06 AB1908