Help with a Dataview JS Codeblock?

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,
};