|| Metaviews | Resolving State (E)﹕ Freegrouped


These concepts were removed from another one of the zones for arbitrary grouping. The resting directory is still the name of the top-left concept, but the path there varies.


let pages = dv.pages('"Concepts/Concepts"')
    .where(p => p.file.path.includes("/(E)/"));
 
// Outer grouping: directory immediately before "/(A)/"
let outerGrouped = pages.groupBy(p => {
    let path = p.file.path;
    let match = path.match(/([^\/]+)\/\(E\)\//);
    return match ? match[1] : "Unknown";
});
 
// Display results with three levels of grouping
for (let outerGroup of outerGrouped) {
    dv.header(2, outerGroup.key);
    
    // Middle grouping: directory immediately after "/(D)/"
    let middleGrouped = outerGroup.rows.groupBy(p => {
        let path = p.file.path;
        let match = path.match(/\/\(E\)\/([^\/]+)/);
        return match ? match[1] : "Unknown";
    });
    
    for (let middleGroup of middleGrouped) {
        dv.header(4, "--> " + middleGroup.key + " <--");
        
        // Inner grouping: immediate parent directory of the file
        let innerGrouped = middleGroup.rows.groupBy(p => {
            let path = p.file.path;
            let parts = path.split('/');
            // Get the parent directory (second to last element)
            return parts.length >= 2 ? parts[parts.length - 2] : "Root";
        });
        
        for (let innerGroup of innerGrouped) {
            dv.header(6, innerGroup.key);
            dv.list(innerGroup.rows.map(p => p.file.link));
        }
    }
}

Details

Reasons include:

  • to allow nesting
  • to prevent saturation of one of the other zones
  • they are formulations