<%* // ---- Pick parent organization (University, College, or Company) ---- const candidates = app.vault.getMarkdownFiles() .filter(f => f.path.startsWith("Organizations/Universities/") || f.path.startsWith("Organizations/Colleges/") || f.path.startsWith("Organizations/Companies/") ) .sort((a, b) => a.basename.localeCompare(b.basename)); if (candidates.length === 0) { new Notice("No Universities/Colleges/Companies found. Create one first."); throw new Error("No parent organizations to attach to."); } const parent = await tp.system.suggester( f => `${f.basename} (${f.parent.name})`, candidates, true, "Parent organization" ); // ---- Department name ---- const rawName = await tp.system.prompt( "Department name (e.g., \"Computer Science\")", "", true ); const name = rawName.trim(); if (!name) { new Notice("Name is required."); throw new Error("Empty name."); } // ---- Optional contact info ---- const email = (await tp.system.prompt("Email (optional)", "")) || ""; const phone = (await tp.system.prompt("Phone (optional)", "")) || ""; // ---- Build filename with top-level institution prefix ---- // If parent name contains " — " (e.g., "State University — School of Computing"), use the part before it. // Otherwise (a University or Company without an em-dash), use the parent name as the prefix. const institutionPrefix = parent.basename.split(" — ")[0]; const fileBase = `${institutionPrefix} — ${name}`; // ---- Move into Departments folder and emit content ---- await tp.file.move(`Organizations/Departments/${fileBase}`); tR += `--- type: department parent_organization: - "[[${parent.basename}]]" email: ${email} phone: ${phone} ---`; -%> ## About ## People ```dataview TABLE WITHOUT ID file.link AS "Person", role AS "Role", email AS "Email", phone AS "Phone" FROM "People" WHERE contains(departments, this.file.link) SORT file.name ASC ``` ## Activities ```dataviewjs const thisPath = dv.current().file.path; const people = dv.pages('"People"') .where(p => { const ds = p.departments; if (!ds) return false; const arr = Array.isArray(ds) ? ds : [ds]; return arr.some(l => l && l.path === thisPath); }); const peoplePaths = new Set(people.map(p => p.file.path)); const acts = dv.pages('"Activities"') .where(p => { const pep = p.people; if (!pep) return false; const arr = Array.isArray(pep) ? pep : [pep]; return arr.some(l => l && peoplePaths.has(l.path)); }) .sort(p => p.date, "desc"); if (acts.length === 0) { dv.el("p", "No activities yet.", { attr: { style: "color: var(--text-muted); font-style: italic;" } }); } else { dv.table( ["Note", "Type", "Date", "Subject", "People"], acts.map(a => [ a.file.link, a.type || "", String(a.date || ""), a.subject || a.topic || a.file.name, a.people || "" ]) ); } ```