Query page's content based on heading and tags

Hi,

I’m opening this topic following @kepano’s recommandation from Twitter.

My main use case with Obsidian is to build periodic reports based on the daily notes I write.

My daily notes are written with the Periodic Notes plugin, with the following path:

Journal/YYYY/MM/[W]ww/YYYY-MM-DD

So for example: Journal/2023/08/W34/2023-08-23

In my Daily note, I have multiple section with bullet points in a hierarchy:

# Thursday, 24th August
## Bugs to Address

- Replicate reported UI glitch in the settings menu
- Debug API response for the user profile endpoint
    - Check if it’s an issue with the database query
- Data synchronization bug in the mobile app is #done

## New Features to Implement

- Design the new user dashboard layout
- Code the authentication flow for the new SSO integration

→ How can I create a weekly report and extract the content of the Bugs to Address section, while keeping the bullet point structure ?

I found the following topics have potential solution: Query bulleted dates and/or tag under a specific header: advice

Which is to combine FLATTEN and meta in order to filter on the heading.

Possible solution:

LIST rows.item.text
FROM "Journal/2023/08/W34"
FLATTEN file.lists as item
WHERE meta(item.section).subpath = "Bugs to Address"
GOUP BY link(file.name)

However, this will break the bullet points nesting structure.

My question is: how can I do that ?

@kepano 's proposed solution to use the transclude feature would work:

# Weekly report

## Bugs to address

- ![[2023-08-23#Bugs-to-Address]]
- ![[2023-08-24#Bugs-to-Address]]
...

However you miss the power of the query language to filter on specific tags (for example #done)

So i’m not sure how to address this ?

Thank you in advance !

Moved from Bug Reports to Help.

If you format the list as task list items, I believe you can use the Tasks community plugin to do what you want.

# Thursday, 24th August
## Bugs to Address

- [ ] Replicate reported UI glitch in the settings menu
- [ ] Debug API response for the user profile endpoint
    - [ ] Check if it’s an issue with the database query
- [x] Data synchronization bug in the mobile app is #done

## New Features to Implement

- [ ] Design the new user dashboard layout
- [ ] Code the authentication flow for the new SSO integration

Hi @CawlinTeffid ,

thank you for your answer !

Indeed I could reuse the task list items, and use the headings filter to extract the section I want.

However, my notes are not limited to task lists, they are more like logs or journals.

That’s why I want a more powerful way of querying a section with Obsidian native queries.

In the meantime I managed to build a solution based on @kepano 's suggestion with transclusion and dataviewJS:

const curdate = moment("{{date:YYYY-MM-DD}}");
const section = ' 📖Log'
// Journal/2023/Q3/08/W34
const weekpath = `Journal/${curdate.format('YYYY/MM/[W]ww')}`;
const daily_notes = dv.pagePaths(`"${weekpath}"`);
for (const day_path of daily_notes) {
    //const day_name = dv.page(`"${day_path}"`).file.title;
    // 2023-08-26
    const day_str = day_path.split('/')[4].split('.')[0];
    // Saturday
    const day_name = moment(day_str).format('dddd');
    // [[Journal/2023/08/W34/2023-08-26|Saturday]]![[Journal/2023/08/W34/2023-08-26# 📖Log]]
    const trans_daily = `[[${day_path}|${day_name}]]![[${day_path}#${section}]]`;
    dv.paragraph(trans_daily);
}

Which rends as:

image

So it works so far.

I would like to highlight this feature request:

Because I would also find it very useful to rename the ‘Log’ header in my transclusion to the day’s name.

No way to filter on tags here however.
And the dataview query is brittle and complex to maintain.

Would be happy to receive feedback !

PS: I have one bug to report, when the first report is generated with the transclusion, the transclusion works, and then switches back to “non transclusion” anymore, as if the files didn’t exist. (??)

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