Help with a Dataview JS Codeblock?

Hi there - I’m hoping that someone who knows dataviewjs can instruct me how to write this simple codeblock:

I have many project pages. Each is tagged with #project, and each is associated to one or more area tags using key :: values (i.e., Areas:: #research, #mocap). Each page has a summary section that begins with the header “Summary”.

The codeblock should display each project with the title as a header (H3) followed by the summary, and should group the projects by Area.

Can anyone provide some sample code that will render this?

Many thanks in advance.

Questions:
1 - What’s your level of knowledge in dataview? Until now, what have you achieved?
2 - Sections (headers) aren’t per se metadata. Sections are an implicit metadata only if associated with lists or tasks. Dataview doesn’t work will full content.

1 - What’s your level of knowledge in dataview? Until now, what have you achieved?

I use the Dataview Query Language regularly throughout my vault to generate tables, lists, etc. as needed. The only dataviewjs codeblocks I currently use I’ve copy/pasted from others. (I’m not too familiar with JS.)

I’ve taken a few cracks of my own on this and managed a) to generate a list of projects grouped under the areas with following code (copped from this forum post):

let pages = dv.pages("#projects").where(b => b.status != “archived”);
for (let group of pages.groupBy(b => b.areas)) {
   dv.header(3,group.key);
   dv.list(group.rows.file.name);
}

…and b) to render the Summary section of a single page using this block (from the dataview Plug-in docs):

 
dv.paragraph(dv.sectionLink(“A Project Page”, “Summary”, true))

2 - Sections (headers) aren’t per se metadata. Sections are an implicit metadata only if associated with lists or tasks. Dataview doesn’t work will full content.

I think dv.sectionLink() does exactly what I want to do…? What is probably missing for me is the JS knowledge to combine both pieces above (return all projects, group them, and output the specific section for each.

@mnvwvnm can you help?

Now that you’ve got your list of project pages from Dataview, you can iterate through them and extract the Summary section via regex.

I would love to know if there’s a better way to do this, hopefully someone chimes in. But this is a totally workable solution.

Make sure to change ## Summary to match the level of header you’re using (I’m using level 2 here).

```dataviewjs
const header = '## Summary'

// You can update this to filter as you like
const pages = dv.pages("#projects")

// This regex will return text from the Summary header, until it reaches
// the next header, a horizontal line, or the end of the file
const regex = new RegExp(`\n${header}\r?\n(.*?)(\n#|\n---|$)`, 's')

for (const page of pages) {
    const file = app.vault.getAbstractFileByPath(page.file.path)
    // Read the file contents
    const contents = await app.vault.read(file)
    // Extract the summary via regex
    const summary = contents.match(regex)
    if (summary) {
        // Output the header and summary
        dv.header(3, file.basename)
        dv.paragraph(summary[1].trim())
    }
}
```
1 Like

@AlanG solution seems a nice way.

As said before, dataview doesn’t read the full content. Your suggestion of dv.sectionLink() works like an Obsidian embed, but it doesn’t work very well.

@AlanG solution takes the content via obsidian API and apply regex to “filter” the content.

For dumbs in JS and regex (like me), I suggest other ways to write the content: using inline fields or lists.

Using inline field

## Summary
summary:: Aenean eu magna vel nulla **vulputate** faucibus. Suspendisse laoreet et est eu dapibus. Sed hendrerit lorem tristique sapien vestibulum congue. Nulla facilisi. Integer id sollicitudin lorem. Integer egestas porta mauris, nec condimentum enim sodales quis.

queries:

LIST "<br>" + summary
FROM #projects
WHERE summary
TABLE summary
FROM #projects
WHERE summary

Using lists

## Summary
- Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer aliquet eu nibh sed pharetra. Praesent sit amet magna vel lacus condimentum finibus id ac quam. Cras eu eros posuere, molestie lacus at, laoreet purus. Phasellus sodales ex turpis, et vehicula mauris euismod at. Duis pulvinar dictum commodo. Etiam auctor urna non nunc mollis mollis. #tag1
- Interdum et malesuada fames ac ante ipsum primis in faucibus. Sed erat nulla, scelerisque at consectetur vel, lobortis quis mauris. Donec ut vehicula augue. Donec nec elit malesuada, posuere nibh vitae, lacinia elit. #tag2 
- Nulla dignissim cursus pretium. Proin luctus ante sed mi elementum feugiat. Vivamus quis eros a nisi condimentum maximus vitae nec tortor. Sed fermentum felis eu tristique vehicula. #tag1
- Aenean eu magna vel nulla vulputate faucibus. Suspendisse laoreet et est eu dapibus. Sed hendrerit lorem tristique sapien vestibulum congue. Nulla facilisi. Integer id sollicitudin lorem. Integer egestas porta mauris, nec condimentum enim sodales quis.

queries:

LIST rows.L.text
FROM #projects
FLATTEN file.lists AS L
WHERE meta(L.section).subpath = "Summary"
GROUP BY file.link
TABLE rows.L.text AS "Summary"
FROM #projects
FLATTEN file.lists AS L
WHERE meta(L.section).subpath = "Summary"
GROUP BY file.link

(only lists with a specific word in text)

TABLE rows.L.text AS "Summary"
FROM #Projects
FLATTEN file.lists AS L
WHERE meta(L.section).subpath = "Summary"
WHERE icontains(L.text, "lorem")
GROUP BY file.link
1 Like

Thanks both! I’m traveling right now so haven’t had a chance to check them out but will shorty. Much appreciate the suggestions.

Topic: The file.lists by example

  • The file.lists by example - Chapter 2 : using DVJS to gather list items or task items under the specific heading and group by a column (and group by another column)
Summary
  1. How to group by a column?
  2. How to group by a column on a already grouped query?
  3. How to gather list items or task items where the heading is “Summary”?
  4. How to display list items or task items where the heading is “Summary” with the desired structure? (DVJS01, DVJS12, DVJS20, DVJS30)
  5. How to display list items or task items where the heading is “Summary” without the desired structure? (DVJS10)

Q: How to distinguish list items from task items from the file.lists data?

Answers

  • a list item: !L.task
  • a task item: L.task
  • L : each element of file.lists of each page
  • No one can distinguish a list item from a task item from the value of L.text where L is an element of file.lists .

Q: How did I have to modify the DVJS, if I’d like to just search for headings, which contain “what: milestones, tasks!”?

for DVJS01

the original example
    // M31.FR13 define a_filtered_lists:
    // FLATTEN page.file.lists and gather them: 
    // get items under the heading "Summary"
    // #####################################################################
    let a_filtered_lists = group.rows
        .flatMap((page) => page.file.lists)
        .where(
            (L) => L.header.subpath === "Summary" && L.header.type === "header"
        );
the new example
    // M31.FR13 define a_filtered_lists:
    // FLATTEN page.file.lists and gather them: 
    // get items under the heading "Summary"
    // #####################################################################
    let a_filtered_lists = group.rows
        .flatMap((page) => page.file.lists)
        .where(
            (L) => dv.func.contains(L.header.subpath, "what milestones tasks") && 
                   L.header.type === "header"
        );

Test

Summary
  • dataview: v0.5.41

Input

Summary

dictionary files

  • location: “999_Test/Q17_test_data”

folder: R03

  • filename : dic_20050301
---
Date: 2005-03-01
---
#Project/P03

Areas:: #research


#### input
##### Summary
- [type:: "food"] [desc:: "breakfast"] [cost:: 10] #Test/d01 [[Note J]] , [[Note K]]
- [type:: "food"] [desc:: "breakfast"] [cost:: 20] #Test/d02  [[Note J]]


  • filename : dic_20050306
---
Date: 2005-03-06
---
#Project/P03

Areas:: #research


##### input
###### Summary
- [type:: "food"] [desc:: "dinner"] [cost:: 30] #Test/d03
- (type:: "food") (desc:: "dinner") (cost:: 40) #Test/d04
- (type:: "food") %%(desc:: "dinner")%% %%(cost:: 50)%% #Test/d05
    - C1
        - C2
            - C3
                - C4
                    - C5
                        - C6


folder: A04

  • filename : dic_20050401
---
Date: 2005-04-01
---
#Project/P04

Areas:: #mocap


## input
### Summary
- [ ] [type:: "food"] [desc:: "breakfast"] [cost:: 100] #Test/d01 [[Note P]] , [[Note Q]]
- [ ] [type:: "food"] [desc:: "breakfast"] [cost:: 200] #Test/d02  [[Note P]]


  • filename : dic_20050406
---
Date: 2005-04-06
---
#Project/P04

Areas:: #mocap


### input
#### Summary
- [ ] [type:: "food"] [desc:: "dinner"] [cost:: 306] #Test/d03
- [x] (type:: "food") (desc:: "dinner") (cost:: 406) #Test/d04
- [ ] (type:: "food") %%(desc:: "dinner")%% %%(cost:: 506)%% #Test/d05
    - [ ] C1
        - [ ] C2
            - [ ] C3
                - [ ] C4
                    - [ ] C5
                        - [ ] C6



folder: M05_empty

  • filename : dic_20050501
---
Date: 2005-05-01
---
#Project/P05

Areas:: #mocap


## input
### Summary



  • filename : dic_20050506
---
Date: 2005-05-06
---
#Project/P05

Areas:: #mocap


### input
#### Summary





DVJS01_groupBy_fLink_flatten_fLists_and_taskList

  • To get items under the heading “Summary” with the desired structure
Summary

Main DVJS

Code Name Data type Group By Purposes Remark
DVJS01_groupBy_fLink
_flatten_fLists
_and_taskList
file.lists yes
groupIn:no
1.To groupBy page.file.link AS G1 (G1=group.rows)
2.To display each G1 as a table
3.To flatten page.file.lists
4.To gather list items or task items where the heading is “Summary”
5.To display each G1 as list items or task items [with the desired structure]

code DVJS01_groupBy_fLink_flatten_fLists_and_taskList : get items under the heading “Summary”

Summary_code
title: DVJS01_groupBy_fLink_flatten_fLists_and_taskList => 1.To groupBy page.file.link AS G1 (G1=group.rows) 2.To display each G1 as a table 3.To flatten page.file.lists 4.To gather list items or task items where the heading is "Summary" 5.To display each G1 as list items or task items [with the desired structure]
collapse: close
icon: 
color: 
```dataviewjs
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where((page) => dv.func.contains(page.file.name, "dic_"))
    .where((page) => page.Areas);
    //.sort((page) => page.file.link, "desc");


// M21. define groups:
// To groupBy page.file.link AS G1 (G1=group.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.file.link);
    //.sort((group) => group.key, "desc");


// M31. output groups:
// #####################################################################
for (let group of groups) {

    // M31.FR13 define a_filtered_lists:
    // FLATTEN page.file.lists and gather them: 
    // get items under the heading "Summary"
    // #####################################################################
    let a_filtered_lists = group.rows
        .flatMap((page) => page.file.lists)
        .where(
            (L) => L.header.subpath === "Summary" && L.header.type === "header"
        );


    // M31.FR15 check a_filtered_lists.length :
    // #####################################################################
    if (a_filtered_lists.length === 0){
        continue;
    }
    
        
    // M31.FR21 output page.file.link :
    // #####################################################################
    dv.header(3, group.key);
    
    
    // M31.FR23 output a_filtered_lists.text: [with the desired structure]
    // #####################################################################
    dv.taskList(a_filtered_lists, false); 
}


```

Screenshots(DVJS01):

Part 1/2

Part 2/2


DVJS10_groupBy_areas_flatten_fLists_and_span

  • To get items under the heading “Summary” without the desired structure
Summary

Main DVJS

Code Name Data type Group By Purposes Remark
DVJS10_groupBy_areas
_flatten_fLists
_and_span
file.lists yes
groupIn:no
1.To groupBy page.Areas AS G1 (G1=group.rows)
2.To display each G1 as a table
3.To flatten page.file.lists
4.To gather list items or task items where the heading is “Summary”
5.To display each G1 as list items or task items [without the desired structure]

code DVJS10_groupBy_areas_flatten_fLists_and_span : get items under the heading “Summary”

Summary_code
title: DVJS10_groupBy_areas_flatten_fLists_and_span => 1.To groupBy page.Areas AS G1 (G1=group.rows) 2.To display each G1 as a table 3.To flatten page.file.lists 4.To gather list items or task items where the heading is "Summary" 5.To display each G1 as list items or task items [without the desired structure]
collapse: close
icon: 
color: 
```dataviewjs
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where((page) => dv.func.contains(page.file.name, "dic_"))
    .where((page) => page.Areas);    


// M21. define groups:
// To groupBy page.Areas AS G1 (G1=group.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.Areas);
    //.sort((group) => group.key, "desc");


// M31. output groups:
// #####################################################################
for (let group of groups) {
    // M31.FR11 output page.Areas
    // #####################################################################
    dv.header(2, group.key);

    // M31.FR13 define a_filtered_lists:
    // FLATTEN page.file.lists and gather them:
    // get items under the heading "Summary"
    // #####################################################################
    let a_filtered_lists = group.rows
        .flatMap((page) => page.file.lists)
        .where(
            (L) => L.header.subpath === "Summary" && L.header.type === "header"
        );

    // M31.FR17 update a_filtered_lists:  add checkbox for tasks
    // 1.add checkbox for task items 2. add "- " for list items
    // IF use dv.span(a_filtered_lists.text) to output
    // #####################################################################
    a_filtered_lists.forEach((L) => {
        if (L.task) {
            L.text = "- [" + L.status + "] " + L.text;
        } else {
            L.text = "- " + L.text;
        }
        //return L;
    });

    // M31.FR23 output a_filtered_lists.text:
    // #####################################################################
    // dv.table(
    //     ["File", "Summary"],
    //     group.rows.map((page) => [page.file.link, a_filtered_lists.text])
    // );

    // M31.FR33 output a_filtered_lists_of_page.text: groupBy page.file.path
    // [without the desired structure]
    // #####################################################################
    for (let page of group.rows) {
        // M31.FR33.LT10 define a_filtered_lists_of_page : groupBy page.file.path
        // #####################################################################
        let a_filtered_lists_of_page = a_filtered_lists.filter(
            (L) => L.link.path === page.file.path
        );

        // M31.FR33.IF12 check a_filtered_lists.length :
        // #####################################################################
        if (a_filtered_lists_of_page.length === 0) {
            continue;
        }

        //  M31.FR33.DV21 output page.file.link :
        // #####################################################################
        dv.header(3, page.file.link);

        // M31.FR33.DV23 output a_filtered_lists_of_page.text: 
        // [without the desired structure]
        // #####################################################################
        dv.span(a_filtered_lists_of_page.text);
    }


}


```

Screenshots(DVJS10):

Part 1/2

Part 2/2


DVJS12_groupBy_areas_flatten_fLists_and_taskList

  • To get items under the heading “Summary” with the desired structure
Summary

Main DVJS

Code Name Data type Group By Purposes Remark
DVJS12_groupBy_areas
_flatten_fLists
_and_taskList
file.lists yes
groupIn:no
1.To groupBy page.Areas AS G1 (G1=group.rows)
2.To display each G1 as a table
3.To flatten page.file.lists
4.To gather list items or task items where the heading is “Summary”
5.To display each G1 as list items or task items [with the desired structure]

code DVJS12_groupBy_areas_flatten_fLists_and_taskList : get items under the heading “Summary”

Summary_code
title: DVJS12_groupBy_areas_flatten_fLists_and_taskList => 1.To groupBy page.Areas AS G1 (G1=group.rows) 2.To display each G1 as a table 3.To flatten page.file.lists 4.To gather list items or task items where the heading is "Summary" 5.To display each G1 as list items or task items [with the desired structure]
collapse: close
icon: 
color: 
```dataviewjs
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where((page) => dv.func.contains(page.file.name, "dic_"))
    .where((page) => page.Areas);    


// M21. define groups:
// To groupBy page.Areas AS G1 (G1=group.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.Areas);
    //.sort((group) => group.key, "desc");


// M31. output groups:
// #####################################################################
for (let group of groups) {
    // M31.FR11 output page.Areas
    // #####################################################################
    dv.header(2, group.key);

    // M31.FR13 define a_filtered_lists:
    // FLATTEN page.file.lists and gather them: 
    // get items under the heading "Summary"
    // #####################################################################
    let a_filtered_lists = group.rows
        .flatMap((page) => page.file.lists)
        .where(
            (L) => L.header.subpath === "Summary" && L.header.type === "header"
        );

    // M31.FR17 update a_filtered_lists:  add checkbox for tasks
    // 1.add checkbox for task items 2. add "- " for list items
    // IF use dv.span(a_filtered_lists.text) to output
    // #####################################################################
    // a_filtered_lists.forEach((L) => {
    //     if (L.task) {
    //         L.text = "- [" + L.status + "] " + L.text;
    //     } else {
    //         L.text = "- " + L.text;
    //     }
    //     //return L;
    // });

    
    // M31.FR33 output a_filtered_lists.text: groupBy page.file.path
    // [without the desired structure]
    // #####################################################################
    for (let page of group.rows) {
        // M31.FR33.LT10 define a_filtered_lists_of_page : groupBy page.file.path
        // #####################################################################
        let a_filtered_lists_of_page = a_filtered_lists.filter(
            (L) => L.link.path === page.file.path
        );

        // M31.FR33.IF12 check a_filtered_lists.length :
        // #####################################################################
        if (a_filtered_lists_of_page.length === 0) {
            continue;
        }

        //  M31.FR33.DV21 output page.file.link :
        // #####################################################################
        dv.header(3, page.file.link);

        // M31.FR33.DV23 output a_filtered_lists_of_page.text: 
        // [with the desired structure]
        // #####################################################################
        dv.taskList(a_filtered_lists_of_page, false); 
    }



}


```

Screenshots(DVJS12):

Part 1/2

Part 2/2


DVJS20_groupBy_areas_groupIn_title_flatten_fLists_and_taskList

  • To get items under the heading “Summary” with the desired structure
Summary

Main DVJS

Code Name Data type Group By Purposes Remark
DVJS20_groupBy_areas
_groupIn_title
_flatten_fLists_and_taskList
file.lists yes
groupIn:yes
1.To groupBy page.Areas AS G1 (G1=group.rows)
2.To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows)
3.To display each G1 as a table
4.To flatten page.file.lists
5.To gather list items or task items where the heading is “Summary”
6.To display each G1 with each G2 which is grouped in G1 as a taskList [with the desired structure]

code DVJS20_groupBy_areas_groupIn_title_flatten_fLists_and_taskList : get items under the heading “Summary”

Summary_code
title: DVJS20_groupBy_areas_groupIn_title_flatten_fLists_and_taskList => 1.To groupBy page.Areas AS G1 (G1=group.rows) 2.To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows) 3.To display each G1 as a table 4.To flatten page.file.lists 5.To gather list items or task items where the heading is "Summary" 6.To display each G1 with each G2 which is grouped in G1 as a taskList [with the desired structure]
collapse: close
icon: 
color: 
```dataviewjs
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where((page) => dv.func.contains(page.file.name, "dic_"))
    .where((page) => page.Areas);    


// M21. define groups:
// To groupBy page.Areas AS G1 (G1=group.rows)
// To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.Areas)
    //.sort((group) => group.key, "desc")
    .groupIn((page) => page.file.name);


// M31. output groups:
// #####################################################################
for (let group of groups) {
    // M31.HE10 output page.Areas
    // #####################################################################
    dv.header(2, group.key);

    for (let G1 of group.rows) {
        // M31.FR13 define a_filtered_lists:
        // flatten page.file.lists and gather them:
        // get items under the heading "Summary"
        // #####################################################################
        let a_filtered_lists = G1.rows
            .flatMap((page) => page.file.lists)
            .where(
                (L) =>
                    L.header.subpath === "Summary" && L.header.type === "header"
            );

        // M31.FR15 check a_filtered_lists.length :
        // #####################################################################
        if (a_filtered_lists.length === 0) {
            continue;
        }

        // M31.FR21 output page.file.name:
        // #####################################################################
        dv.header(3, G1.key);

        // M31.FR31 update a_filtered_lists:
        // 1.add checkbox for task items 2. add "- " for list items
        // IF use dv.span(a_filtered_lists.text) to output [without the desired structure]
        // #####################################################################
        // a_filtered_lists.forEach((L) => {
        //     if (L.task) {
        //         L.text = "- [" + L.status + "] " + L.text;
        //     } else {
        //         L.text = "- " + L.text;
        //     }
        //     //return L;
        // });

        // M31.FR33 output a_filtered_lists.text: [without the desired structure]
        // #####################################################################
        //dv.span(a_filtered_lists.text);

        // M31.FR41 output a_filtered_lists.text: [with the desired structure]
        // #####################################################################
        dv.taskList(a_filtered_lists, false);
    }
}



```

Screenshots(DVJS20):

Part 1/2

Part 2/2


DVJS30_groupBy_areas_groupIn_title_not_flatten_fLists_and_taskList

  • To get items under the heading “Summary” with the desired structure
Summary

Main DVJS

Code Name Data type Group By Purposes Remark
DVJS30_groupBy_areas
_groupIn_title
_not_flatten_fLists_and_taskList
file.lists yes
groupIn:yes
1.To groupBy page.Areas AS G1 (G1=group.rows)
2.To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows)
3.To display each G1 as a table
4.Not to flatten page.file.lists
5.To gather list items or task items where the heading is “Summary”
6.To display each G1 with each G2 which is grouped in G1 as a taskList [with the desired structure]

code DVJS30_groupBy_areas_groupIn_title_not_flatten_fLists_and_taskList : get items under the heading “Summary”

Summary_code
title: DVJS30_groupBy_areas_groupIn_title_not_flatten_fLists_and_taskList => 1.To groupBy page.Areas AS G1 (G1=group.rows) 2.To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows) 3.To display each G1 as a table 4.Not to flatten page.file.lists 5.To gather list items or task items where the heading is "Summary" 6.To display each G1 with each G2 which is grouped in G1 as a taskList [with the desired structure]
collapse: close
icon: 
color: 
```dataviewjs
// M10. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where((page) => dv.func.contains(page.file.name, "dic_"))
    .where((page) => page.Areas);    


// M11. define groups:
// To groupBy page.Areas AS G1 (G1=group.rows)
// To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.Areas)
    .groupIn((page) => page.file.name);


// M21. define function for expanding search to children:
// #####################################################################
const taskAny = function taskAny(t, f) {
    if (f(t)) {
        return true;
    }
    for (let sub of t.children) {
        if (taskAny(sub, f)) {
            return true;
        }
    }
    return false;
};


// M23. define function for hiding children:
// Case_01  : Show list items                        (original)
// Case_01b : Show task items                        (added)
// //Case_02: Show tasks that are not fullyCompleted (comment)
// //Case_03: Show items that contain note links     (comment)
// #####################################################################
let hide_fullyCompleted_Subtasks = (t) => ({
    ...t,
    children: t.children
        .filter((st) =>
            taskAny(
                st,
                (st) => !st.task || 
                st.task
                //(st.task && !st.fullyCompleted) ||
                //st.outlinks.length > 0
            )
        )
        .map(hide_fullyCompleted_Subtasks),
});


// M51. output groups:
// #####################################################################
for (let group of groups) {
    // M51.HE10 output page.Areas
    // #####################################################################
    dv.header(2, group.key);

    for (let G1 of group.rows) {
        // M51.FR11 define a_filtered_lists: gather root list items or root task items
        // get items under the heading "Summary"
        // #####################################################################
        let tasks_or_lists = G1.rows.file.lists
            .where((L) => (!L.parent && L.task) || (!L.parent && !L.task))
            .where(
                (L) =>
                    L.header.subpath === "Summary" && L.header.type === "header"
            );

        // M51.FR13 Hide completed Subtasks:
        // From root list items or root task items: gather sub-list items or sub-task items
        // #####################################################################
        tasks_or_lists.values = tasks_or_lists.values.map(
            hide_fullyCompleted_Subtasks
        );

        // M51.FR15 check a_filtered_lists.length :
        // #####################################################################
        if (tasks_or_lists.length === 0) {
            continue;
        }

        // M51.FR31 output page.file.name:
        // #####################################################################
        dv.header(3, G1.key);

        // M51.FR33 output tasks_or_lists: [with the desired structure]
        // #####################################################################
        dv.taskList(tasks_or_lists, false);
    }
}

```

Screenshots(DVJS30):

Part 1/2

Part 2/2


Reference

Summary

Related resources

Summary

DVJS10_notes

Summary

Notes:

Summary
the data structure of groups
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where(
        (page) =>
            page.file.name === "dic_20050301" ||
            page.file.name === "dic_20050401"        
    )
    .where((page) => page.Areas);


// M21. define groups:
// To groupBy page.Areas AS G1 (G1=group.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.Areas);
    //.sort((group) => group.key, "desc");

    
// M30. output groups: formatted by Prettier - Code formatter v9.5.0 in VScode
// #####################################################################
//dv.span("The following is the content of the `groups`.\n");
dv.span(JSON.stringify(groups, null, 2), "\n");

  • Here is a slice of the groups , where page.file.name is dic_20050301 or dic_20050401.
let slice_groups = {
    values: [
        {
            key: "#mocap",
            rows: {
                values: [
                    {
                        file: {
                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                            folder: "999_Test/Q17_test_data/A04",
                            name: "dic_20050401",
                            link: {
                                path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                embed: false,
                                type: "file",
                            },
                            outlinks: {
                                values: [
                                    {
                                        path: "Note P",
                                        embed: false,
                                        type: "file",
                                    },
                                    {
                                        path: "Note Q",
                                        embed: false,
                                        type: "file",
                                    },
                                ],

                                length: 2,
                            },
                            inlinks: {
                                values: [],

                                length: 0,
                            },
                            etags: {
                                values: [
                                    "#Project/P04",
                                    "#mocap",
                                    "#Test/d01",
                                    "#Test/d02",
                                ],
                                length: 4,
                            },
                            tags: {
                                values: [
                                    "#Project/P04",
                                    "#Project",
                                    "#mocap",
                                    "#Test/d01",
                                    "#Test",
                                    "#Test/d02",
                                ],
                                length: 6,
                            },

                            lists: {
                                values: [
                                    {
                                        symbol: "-",
                                        link: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        section: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        text: "type food desc breakfast cost 100 #Test/d01 [[Note P]] , [[Note Q]]",
                                        tags: ["#Test/d01"],
                                        line: 9,
                                        lineCount: 1,
                                        list: 9,
                                        outlinks: [
                                            {
                                                path: "Note P",
                                                type: "file",
                                                display: "Note P",
                                                embed: false,
                                            },
                                            {
                                                path: "Note Q",
                                                type: "file",
                                                display: "Note Q",
                                                embed: false,
                                            },
                                        ],
                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                        children: [],
                                        task: true,
                                        annotated: true,
                                        position: {
                                            start: {
                                                line: 9,
                                                col: 0,
                                                offset: 67,
                                            },
                                            end: {
                                                line: 9,
                                                col: 89,
                                                offset: 156,
                                            },
                                        },
                                        subtasks: [],
                                        real: true,
                                        header: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        type: "food",
                                        desc: "breakfast",
                                        cost: 100,
                                        status: " ",
                                        checked: false,
                                        completed: false,
                                        fullyCompleted: false,
                                    },
                                    {
                                        symbol: "-",
                                        link: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        section: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        text: "type food desc breakfast cost 200 #Test/d02 [[Note P]]",
                                        tags: ["#Test/d02"],
                                        line: 10,
                                        lineCount: 1,
                                        list: 9,
                                        outlinks: [
                                            {
                                                path: "Note P",
                                                type: "file",
                                                display: "Note P",
                                                embed: false,
                                            },
                                        ],
                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                        children: [],
                                        task: true,
                                        annotated: true,
                                        position: {
                                            start: {
                                                line: 10,
                                                col: 0,
                                                offset: 157,
                                            },
                                            end: {
                                                line: 10,
                                                col: 77,
                                                offset: 234,
                                            },
                                        },
                                        subtasks: [],
                                        real: true,
                                        header: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        type: "food",
                                        desc: "breakfast",
                                        cost: 200,
                                        status: " ",
                                        checked: false,
                                        completed: false,
                                        fullyCompleted: false,
                                    },
                                ],

                                length: 2,
                            },
                            tasks: {
                                values: [
                                    {
                                        symbol: "-",
                                        link: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        section: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        text: "type food desc breakfast cost 100 #Test/d01 [[Note P]] , [[Note Q]]",
                                        tags: ["#Test/d01"],
                                        line: 9,
                                        lineCount: 1,
                                        list: 9,
                                        outlinks: [
                                            {
                                                path: "Note P",
                                                type: "file",
                                                display: "Note P",
                                                embed: false,
                                            },
                                            {
                                                path: "Note Q",
                                                type: "file",
                                                display: "Note Q",
                                                embed: false,
                                            },
                                        ],
                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                        children: [],
                                        task: true,
                                        annotated: true,
                                        position: {
                                            start: {
                                                line: 9,
                                                col: 0,
                                                offset: 67,
                                            },
                                            end: {
                                                line: 9,
                                                col: 89,
                                                offset: 156,
                                            },
                                        },
                                        subtasks: [],
                                        real: true,
                                        header: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        type: "food",
                                        desc: "breakfast",
                                        cost: 100,
                                        status: " ",
                                        checked: false,
                                        completed: false,
                                        fullyCompleted: false,
                                    },
                                    {
                                        symbol: "-",
                                        link: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        section: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        text: "type food desc breakfast cost 200 #Test/d02 [[Note P]]",
                                        tags: ["#Test/d02"],
                                        line: 10,
                                        lineCount: 1,
                                        list: 9,
                                        outlinks: [
                                            {
                                                path: "Note P",
                                                type: "file",
                                                display: "Note P",
                                                embed: false,
                                            },
                                        ],
                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                        children: [],
                                        task: true,
                                        annotated: true,
                                        position: {
                                            start: {
                                                line: 10,
                                                col: 0,
                                                offset: 157,
                                            },
                                            end: {
                                                line: 10,
                                                col: 77,
                                                offset: 234,
                                            },
                                        },
                                        subtasks: [],
                                        real: true,
                                        header: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        type: "food",
                                        desc: "breakfast",
                                        cost: 200,
                                        status: " ",
                                        checked: false,
                                        completed: false,
                                        fullyCompleted: false,
                                    },
                                ],
                                length: 2,
                            },
                            ctime: "2005-04-01T19:30:50.477+08:00",
                            cday: "2005-04-01T00:00:00.000+08:00",
                            mtime: "2005-04-03T19:30:50.477+08:00",
                            mday: "2005-04-03T00:00:00.000+08:00",
                            size: 235,
                            starred: false,
                            frontmatter: { Date: "2005-04-01" },
                            ext: "md",
                            day: "2005-04-01T00:00:00.000+08:00",
                        },
                        Date: "2005-04-01T00:00:00.000+08:00",
                        Areas: "#mocap",
                        date: "2005-04-01T00:00:00.000+08:00",
                        areas: "#mocap",
                    },
                ],

                length: 1,
            },
        },
        {
            key: "#research",
            rows: {
                values: [
                    {
                        file: {
                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                            folder: "999_Test/Q17_test_data/R03",
                            name: "dic_20050301",
                            link: {
                                path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                embed: false,
                                type: "file",
                            },
                            outlinks: {
                                values: [
                                    {
                                        path: "Note J",
                                        embed: false,
                                        type: "file",
                                    },
                                    {
                                        path: "Note K",
                                        embed: false,
                                        type: "file",
                                    },
                                ],
                                length: 2,
                            },
                            inlinks: { values: [], length: 0 },
                            etags: {
                                values: [
                                    "#Project/P03",
                                    "#research",
                                    "#Test/d01",
                                    "#Test/d02",
                                ],
                                length: 4,
                            },
                            tags: {
                                values: [
                                    "#Project/P03",
                                    "#Project",
                                    "#research",
                                    "#Test/d01",
                                    "#Test",
                                    "#Test/d02",
                                ],
                                length: 6,
                            },

                            lists: {
                                values: [
                                    {
                                        symbol: "-",
                                        link: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        section: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        text: "type food desc breakfast cost 10 #Test/d01 [[Note J]] , [[Note K]]",
                                        tags: ["#Test/d01"],
                                        line: 9,
                                        lineCount: 1,
                                        list: 9,
                                        outlinks: [
                                            {
                                                path: "Note J",
                                                type: "file",
                                                display: "Note J",
                                                embed: false,
                                            },
                                            {
                                                path: "Note K",
                                                type: "file",
                                                display: "Note K",
                                                embed: false,
                                            },
                                        ],
                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                        children: [],
                                        task: false,
                                        annotated: true,
                                        position: {
                                            start: {
                                                line: 9,
                                                col: 0,
                                                offset: 70,
                                            },
                                            end: {
                                                line: 9,
                                                col: 84,
                                                offset: 154,
                                            },
                                        },
                                        subtasks: [],
                                        real: false,
                                        header: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        type: "food",
                                        desc: "breakfast",
                                        cost: 10,
                                    },
                                    {
                                        symbol: "-",
                                        link: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        section: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        text: "type food desc breakfast cost 20 #Test/d02 [[Note J]]",
                                        tags: ["#Test/d02"],
                                        line: 10,
                                        lineCount: 1,
                                        list: 9,
                                        outlinks: [
                                            {
                                                path: "Note J",
                                                type: "file",
                                                display: "Note J",
                                                embed: false,
                                            },
                                        ],
                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                        children: [],
                                        task: false,
                                        annotated: true,
                                        position: {
                                            start: {
                                                line: 10,
                                                col: 0,
                                                offset: 155,
                                            },
                                            end: {
                                                line: 10,
                                                col: 72,
                                                offset: 227,
                                            },
                                        },
                                        subtasks: [],
                                        real: false,
                                        header: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            type: "header",
                                            subpath: "Summary",
                                        },
                                        type: "food",
                                        desc: "breakfast",
                                        cost: 20,
                                    },
                                ],

                                length: 2,
                            },
                            tasks: {
                                values: [],
                                length: 0,
                            },
                            ctime: "2005-03-01T19:30:50.477+08:00",
                            cday: "2005-03-01T00:00:00.000+08:00",
                            mtime: "2005-03-03T19:30:50.477+08:00",
                            mday: "2005-03-03T00:00:00.000+08:00",
                            size: 228,
                            starred: false,
                            frontmatter: { Date: "2005-03-01" },
                            ext: "md",
                            day: "2005-03-01T00:00:00.000+08:00",
                        },
                        Date: "2005-03-01T00:00:00.000+08:00",
                        type: ["food", "food"],
                        desc: ["breakfast", "breakfast"],
                        cost: [10, 20],
                        Areas: "#research",
                        date: "2005-03-01T00:00:00.000+08:00",
                        areas: "#research",
                    },
                ],
                length: 1,
            },
        },
    ],
    length: 2,
};



DVJS20_notes

Summary

Notes:

Summary
the data structure of groups
// M11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
    .pages('"999_Test/Q17_test_data" and #Project')
    .where(
        (page) =>
            page.file.name === "dic_20050301"
    )
    .where((page) => page.Areas);


// M21. define groups:
// To groupBy page.Areas AS G1 (G1=group.rows)
// To groupIn page.file.name AS G2 (G2=group.rows.rows=G1.rows)
// #####################################################################
let groups = pages
    .groupBy((page) => page.Areas)
    //.sort((group) => group.key, "desc")
    .groupIn((page) => page.file.name);

    
// M30. output groups: formatted by Prettier - Code formatter v9.5.0 in VScode
// #####################################################################
//dv.span("The following is the content of the `groups`.\n");
dv.span(JSON.stringify(groups, null, 2), "\n");

  • Here is a slice of the groups , where page.file.name is dic_20050301 or dic_20050401.
let slice_groups = {
    values: [
        {
            key: "#mocap",
            rows: {
                values: [
                    {
                        key: "dic_20050401",
                        rows: {
                            values: [
                                {
                                    file: {
                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                        folder: "999_Test/Q17_test_data/A04",
                                        name: "dic_20050401",
                                        link: {
                                            path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                            embed: false,
                                            type: "file",
                                        },
                                        outlinks: {
                                            values: [
                                                {
                                                    path: "Note P",
                                                    embed: false,
                                                    type: "file",
                                                },
                                                {
                                                    path: "Note Q",
                                                    embed: false,
                                                    type: "file",
                                                },
                                            ],                                            
                                            length: 2,
                                        },
                                        inlinks: {
                                            values: [],                                            
                                            length: 0,
                                        },
                                        etags: {
                                            values: [
                                                "#Project/P04",
                                                "#mocap",
                                                "#Test/d01",
                                                "#Test/d02",
                                            ],                                            
                                            length: 4,
                                        },
                                        tags: {
                                            values: [
                                                "#Project/P04",
                                                "#Project",
                                                "#mocap",
                                                "#Test/d01",
                                                "#Test",
                                                "#Test/d02",
                                            ],                                            
                                            length: 6,
                                        },                                        
                                        tasks: {
                                            values: [
                                                {
                                                    symbol: "-",
                                                    link: {
                                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    section: {
                                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    text: "type food desc breakfast cost 100 #Test/d01 [[Note P]] , [[Note Q]]",
                                                    tags: ["#Test/d01"],
                                                    line: 9,
                                                    lineCount: 1,
                                                    list: 9,
                                                    outlinks: [
                                                        {
                                                            path: "Note P",
                                                            type: "file",
                                                            display: "Note P",
                                                            embed: false,
                                                        },
                                                        {
                                                            path: "Note Q",
                                                            type: "file",
                                                            display: "Note Q",
                                                            embed: false,
                                                        },
                                                    ],
                                                    path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                    children: [],
                                                    task: true,
                                                    annotated: true,
                                                    position: {
                                                        start: {
                                                            line: 9,
                                                            col: 0,
                                                            offset: 67,
                                                        },
                                                        end: {
                                                            line: 9,
                                                            col: 89,
                                                            offset: 156,
                                                        },
                                                    },
                                                    subtasks: [],
                                                    real: true,
                                                    header: {
                                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    type: "food",
                                                    desc: "breakfast",
                                                    cost: 100,
                                                    status: " ",
                                                    checked: false,
                                                    completed: false,
                                                    fullyCompleted: false,
                                                },
                                                {
                                                    symbol: "-",
                                                    link: {
                                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    section: {
                                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    text: "type food desc breakfast cost 200 #Test/d02 [[Note P]]",
                                                    tags: ["#Test/d02"],
                                                    line: 10,
                                                    lineCount: 1,
                                                    list: 9,
                                                    outlinks: [
                                                        {
                                                            path: "Note P",
                                                            type: "file",
                                                            display: "Note P",
                                                            embed: false,
                                                        },
                                                    ],
                                                    path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                    children: [],
                                                    task: true,
                                                    annotated: true,
                                                    position: {
                                                        start: {
                                                            line: 10,
                                                            col: 0,
                                                            offset: 157,
                                                        },
                                                        end: {
                                                            line: 10,
                                                            col: 77,
                                                            offset: 234,
                                                        },
                                                    },
                                                    subtasks: [],
                                                    real: true,
                                                    header: {
                                                        path: "999_Test/Q17_test_data/A04/dic_20050401.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    type: "food",
                                                    desc: "breakfast",
                                                    cost: 200,
                                                    status: " ",
                                                    checked: false,
                                                    completed: false,
                                                    fullyCompleted: false,
                                                },
                                            ],                                            
                                            length: 2,
                                        },
                                        ctime: "2005-04-01T19:30:50.477+08:00",
                                        cday: "2005-04-01T00:00:00.000+08:00",
                                        mtime: "2005-04-03T19:30:50.477+08:00",
                                        mday: "2005-04-03T00:00:00.000+08:00",
                                        size: 235,
                                        starred: false,
                                        frontmatter: { Date: "2005-04-01" },
                                        ext: "md",
                                        day: "2005-04-01T00:00:00.000+08:00",
                                    },
                                    Date: "2005-04-01T00:00:00.000+08:00",
                                    Areas: "#mocap",
                                    date: "2005-04-01T00:00:00.000+08:00",
                                    areas: "#mocap",
                                },
                            ],                            
                            length: 1,
                        },
                    },
                ],                
                length: 1,
            },
        },
        {
            key: "#research",
            rows: {
                values: [
                    {
                        key: "dic_20050301",
                        rows: {
                            values: [
                                {
                                    file: {
                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                        folder: "999_Test/Q17_test_data/R03",
                                        name: "dic_20050301",
                                        link: {
                                            path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                            embed: false,
                                            type: "file",
                                        },
                                        outlinks: {
                                            values: [
                                                {
                                                    path: "Note J",
                                                    embed: false,
                                                    type: "file",
                                                },
                                                {
                                                    path: "Note K",
                                                    embed: false,
                                                    type: "file",
                                                },
                                            ],                                            
                                            length: 2,
                                        },
                                        inlinks: {
                                            values: [],                                            
                                            length: 0,
                                        },
                                        etags: {
                                            values: [
                                                "#Project/P03",
                                                "#research",
                                                "#Test/d01",
                                                "#Test/d02",
                                            ],                                            
                                            length: 4,
                                        },
                                        tags: {
                                            values: [
                                                "#Project/P03",
                                                "#Project",
                                                "#research",
                                                "#Test/d01",
                                                "#Test",
                                                "#Test/d02",
                                            ],                                            
                                            length: 6,
                                        },                                        
                                        lists: {
                                            values: [
                                                {
                                                    symbol: "-",
                                                    link: {
                                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    section: {
                                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    text: "type food desc breakfast cost 10 #Test/d01 [[Note J]] , [[Note K]]",
                                                    tags: ["#Test/d01"],
                                                    line: 9,
                                                    lineCount: 1,
                                                    list: 9,
                                                    outlinks: [
                                                        {
                                                            path: "Note J",
                                                            type: "file",
                                                            display: "Note J",
                                                            embed: false,
                                                        },
                                                        {
                                                            path: "Note K",
                                                            type: "file",
                                                            display: "Note K",
                                                            embed: false,
                                                        },
                                                    ],
                                                    path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                    children: [],
                                                    task: false,
                                                    annotated: true,
                                                    position: {
                                                        start: {
                                                            line: 9,
                                                            col: 0,
                                                            offset: 70,
                                                        },
                                                        end: {
                                                            line: 9,
                                                            col: 84,
                                                            offset: 154,
                                                        },
                                                    },
                                                    subtasks: [],
                                                    real: false,
                                                    header: {
                                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    type: "food",
                                                    desc: "breakfast",
                                                    cost: 10,
                                                },
                                                {
                                                    symbol: "-",
                                                    link: {
                                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    section: {
                                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    text: "type food desc breakfast cost 20 #Test/d02 [[Note J]]",
                                                    tags: ["#Test/d02"],
                                                    line: 10,
                                                    lineCount: 1,
                                                    list: 9,
                                                    outlinks: [
                                                        {
                                                            path: "Note J",
                                                            type: "file",
                                                            display: "Note J",
                                                            embed: false,
                                                        },
                                                    ],
                                                    path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                    children: [],
                                                    task: false,
                                                    annotated: true,
                                                    position: {
                                                        start: {
                                                            line: 10,
                                                            col: 0,
                                                            offset: 155,
                                                        },
                                                        end: {
                                                            line: 10,
                                                            col: 72,
                                                            offset: 227,
                                                        },
                                                    },
                                                    subtasks: [],
                                                    real: false,
                                                    header: {
                                                        path: "999_Test/Q17_test_data/R03/dic_20050301.md",
                                                        type: "header",
                                                        subpath: "Summary",
                                                    },
                                                    type: "food",
                                                    desc: "breakfast",
                                                    cost: 20,
                                                },
                                            ],                                            
                                            length: 2,
                                        },
                                        tasks: {
                                            values: [],                                            
                                            length: 0,
                                        },
                                        ctime: "2005-03-01T19:30:50.477+08:00",
                                        cday: "2005-03-01T00:00:00.000+08:00",
                                        mtime: "2005-03-03T19:30:50.477+08:00",
                                        mday: "2005-03-03T00:00:00.000+08:00",
                                        size: 228,
                                        starred: false,
                                        frontmatter: {
                                            Date: "2005-03-01",
                                        },
                                        ext: "md",
                                        day: "2005-03-01T00:00:00.000+08:00",
                                    },
                                    Date: "2005-03-01T00:00:00.000+08:00",
                                    type: ["food", "food"],
                                    desc: ["breakfast", "breakfast"],
                                    cost: [10, 20],
                                    Areas: "#research",
                                    date: "2005-03-01T00:00:00.000+08:00",
                                    areas: "#research",
                                },
                            ],                            
                            length: 1,
                        },
                    },
                ],                
                length: 1,
            },
        },
    ],    
    length: 2,
};




@justdoitcc how does that get the full-text of the section? I don’t see it in the code, but maybe I’m missing something.

Thanks for your reminder! I forgot to write the following comment:

// get items under the heading "Summary"

But that only works for list items, correct? Not for the full text of a section?

Great observation! No one can distinguish a list item from a task item from the value of L.text where L is an element of file.lists .

Here is a good start to understand it.

Notes

Summary
  1. The file.lists contain both list items and task items.

  2. How to distinguish list items from task items from the file.lists data?

  • a list item: !L.task
  • a task item: L.task
  • L : each element of file.lists of each page
  1. Each screenshot of the following DVJS contains both list items and task items.
  • DVJS01
  • DVJS10
  • DVJS12
  • DVJS20
  • DVJS30

But that only works for list items, correct? Not for the full text of a section?


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