Summary_Q1
Original Example: Q1 (To be explained)
```dataviewjs
// D11. define pages: gather all relevant pages
// #####################################################################
//let pages = dv.current();
let pages = dv
.pages('"999_Test/Q16_test_data"')
.where((page) => page.Residencia)
.where((page) => page.Clan)
.where(
(page) =>
page.file.name === "dic_20080301" ||
page.file.name === "dic_20080401"
);
// D21. define groups:
// groupBy_CASE:To group each `page` of the `pages` by `page.Residencia`
// (Results:)(key=G1.key)(values=G1.rows)
//
// Each `G1.key` is a value from the `page.Residencia`.
// Each `G1.rows` is an Array of JavaScript Objects.
//
// (comments)sort_CASE:To sort each `G1.rows` of the `G1` by `G1.key` in descending order
//
// groupIn_CASE:To group each `G1.rows` of the `G1` by `G1.rows.Clan`
// (Results:)(key=G2.key)(values=G2.rows=G1.rows.rows)
//
// Each `G2.key` is a value from the `G1.rows.Clan`.
// Each `G2.rows` is an Array of JavaScript Objects.
//
// The Bottom Level(Grouped Twice): `G2`=`G1.rows`;` G2.rows`=`page`
// #####################################################################
let groups = pages
.groupBy((page) => page.Residencia) // groupBy: (default) in ascending order
// .sort((G1) => G1.key, "desc")
.groupIn((G1) => G1.Clan); // groupIn: (default) in ascending order
// D30. 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");
```
A1_11:
Another Example: A1_11
- Here is a slice of the
groups
, where page.file.name
is dic_20080301
or dic_20080401
.
Tips:
- groupBy_CASE:To group each
page
of the pages
by page.Residencia
(Results:)(key=G1.key)(values=G1.rows)
- groupIn_CASE:To group each
G1.rows
of the G1
by G1.Clan
(Results:)(key=G2.key)(values=G2.rows=G1.rows.rows)
- The Bottom Level(Grouped Twice):
G2
=G1.rows
; G2.rows
=page
```JSON
let slice_groups = {
values: [
{
key: "BUENOS AIRES",
rows: {
values: [
{
key: "Ventrue",
rows: {
values: [
{
file: {
path: "999_Test/Q16_test_data/03/dic_20080301.md",
folder: "999_Test/Q16_test_data/03",
name: "dic_20080301",
link: {
path: "999_Test/Q16_test_data/03/dic_20080301.md",
embed: false,
type: "file",
},
ctime: "2008-03-01T19:30:50.091+08:00",
cday: "2008-03-01T00:00:00.000+08:00",
mtime: "2008-03-03T19:30:50.091+08:00",
mday: "2008-03-03T00:00:00.000+08:00",
size: 121,
starred: false,
frontmatter: { Date: "2008-03-01" },
ext: "md",
day: "2008-03-01T00:00:00.000+08:00",
},
Date: "2008-03-01T00:00:00.000+08:00",
Residencia: "BUENOS AIRES",
Clan: "Ventrue",
Cainita: "Vortex",
Generacion: 6,
Status: "En Desgracia",
date: "2008-03-01T00:00:00.000+08:00",
residencia: "BUENOS AIRES",
clan: "Ventrue",
cainita: "Vortex",
generacion: 6,
status: "En Desgracia",
},
{
file: {
path: "999_Test/Q16_test_data/04/dic_20080401.md",
folder: "999_Test/Q16_test_data/04",
name: "dic_20080401",
link: {
path: "999_Test/Q16_test_data/04/dic_20080401.md",
embed: false,
type: "file",
},
ctime: "2008-04-01T19:30:50.091+08:00",
cday: "2008-04-01T00:00:00.000+08:00",
mtime: "2008-04-03T19:30:50.091+08:00",
mday: "2008-04-03T00:00:00.000+08:00",
size: 126,
starred: false,
frontmatter: {
Date: "2008-04-01",
},
ext: "md",
day: "2008-04-01T00:00:00.000+08:00",
},
Date: "2008-04-01T00:00:00.000+08:00",
Residencia: "BUENOS AIRES",
Clan: "Ventrue",
Cainita: "Maurtice Durant",
Generacion: 10,
Status: "Neonato",
date: "2008-04-01T00:00:00.000+08:00",
residencia: "BUENOS AIRES",
clan: "Ventrue",
cainita: "Maurtice Durant",
generacion: 10,
status: "Neonato",
},
],
length: 2,
},
},
],
length: 1,
},
},
],
length: 1,
};
```
Summary_Q2
Original Example: Q2 (To be outputed)
```dataviewjs
// M21. define groups:
// #####################################################################
let groups = pages
.groupBy((page) => page.Residencia) // groupBy: (default) in ascending order
// .sort((G1) => G1.key, "desc")
.groupIn((G1) => G1.Clan); // groupIn: (default) in ascending order
```
A2_21:
Another Example: Code DVJS20_A2_21
title: DVJS20_A2_21 =>
collapse: close
icon:
color:
```dataviewjs
// D11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
.pages('"999_Test/Q16_test_data"')
.where((page) => page.Residencia)
.where((page) => page.Clan);
// .where(
// (page) =>
// page.file.name === "dic_20080301" ||
// page.file.name === "dic_20080401"
// );
// D21. define groups:
// groupBy_CASE:To group each `page` of the `pages` by `page.Residencia`
// (Results:)(key=G1.key)(values=G1.rows)
//
// Each `G1.key` is a value from the `page.Residencia`.
// Each `G1.rows` is an Array of JavaScript Objects.
//
// (comments)sort_CASE:To sort each `G1.rows` of the `G1` by `G1.key` in descending order
//
// groupIn_CASE:To group each `G1.rows` of the `G1` by `G1.rows.Clan`
// (Results:)(key=G2.key)(values=G2.rows=G1.rows.rows)
//
// Each `G2.key` is a value from the `G1.rows.Clan`.
// Each `G2.rows` is an Array of JavaScript Objects.
//
// The Bottom Level(Grouped Twice): `G2`=`G1.rows`; `G2.rows`=`page`
// #####################################################################
let groups = pages
.groupBy((page) => page.Residencia) // groupBy: (default) in ascending order
// .sort((G1) => G1.key, "desc")
.groupIn((G1) => G1.Clan); // groupIn: (default) in ascending order
// D30. 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");
// D51. output groups:
// #####################################################################
for (let G1 of groups) {
// D31.FR10 output G1.key: H3
// G1.key: the value of the `Residencia` field
// Q16_GroupIn_CASE: "BUENOS AIRES", "PARIS", "USA"
// #####################################################################
dv.header(3, G1.key);
// D31.FR12 sort G1.rows: in descending order
// G1.rows.key: the value of the `Clan` field
// Q16_GroupIn_CASE: "Malkavian", "Toreador", "Tremere", "Ventrue"
// G2.key=G1.rows.key
// #####################################################################
// G1.rows = G1.rows.sort((G2) => G2.key, "desc");
// D31.FR20 output G1.rows:
// #####################################################################
for (let G2 of G1.rows) {
// D31.FR20.FR11 output G2.key: H6
// Q16_GroupIn_CASE: "Malkavian", "Toreador", "Tremere", "Ventrue"
// #####################################################################
dv.header(6, G2.key);
// D31.FR20.FR51 output page: TABLE
// #####################################################################
// Display the result as a table
// dv.table(
// ["Cainita", "Generacion", "Status", "Link"],
// G2.rows
// .sort((page) => page.Cainita, "asc")
// .map((page) => [
// page.Cainita,
// page.Generacion,
// page.Status,
// page.file.link,
// ])
// );
// M31.FR20.FR70 sort Cost: LIST
// #####################################################################
// Remarked by Justdoitcc 2023-01-14 20:00
// Display the result as a list
G2.rows = G2.rows.sort((page) => page.Cainita, "asc");
// D31.FR20.FR71 output G2.rows: LIST
// #####################################################################
// Remarked by Justdoitcc 2023-01-14 20:00
// Display the result as a list
for (let page of G2.rows) {
// D31.FR20.FR71.FR10 define a_List:
// #####################################################################
// Remarked by Justdoitcc 2023-01-14 20:00
let a_List = [
"Cainita=" + page.Cainita,
"Generacion=" + page.Generacion,
"Status=" + page.Status,
"Link=" + page.file.link,
];
// D31.FR20.FR71.FR12 define s_List:
// #####################################################################
// Remarked by Justdoitcc 2023-01-14 20:00
// let s_List = "• " + a_List.join("; ") + "; <br>";
let s_List = "- " + a_List.join("; ") + "; <br>";
// D31.FR20.FR71.FR20 output page:
// #####################################################################
// Remarked by Justdoitcc 2023-01-14 20:00
// Display the result as a list
dv.span(s_List);
// Remarked by Justdoitcc 2023-01-14 20:00
// Display the result as a list
}
}
}
```
Screenshots(DVJS20_A2_21)
Summary_Q3
Original Example: Q3 (To be outputed)
```dataviewjs
// M21. define groups:
// #####################################################################
let groups = pages
.groupBy((page) => page.Residencia) // groupBy: (default) in ascending order
// .sort((G1) => G1.key, "desc")
.groupIn((G1) => G1.Clan); // groupIn: (default) in ascending order
```
A3_31:
Another Example: Code DVJS20_A3_31
title: DVJS20_A3_31 =>
collapse: close
icon:
color:
```dataviewjs
// D11. define pages: gather all relevant pages
// #####################################################################
let pages = dv
.pages('"999_Test/Q16_test_data"')
.where((page) => page.Residencia)
.where((page) => page.Clan);
// .where(
// (page) =>
// page.file.name === "dic_20080301" ||
// page.file.name === "dic_20080401"
// );
// D21. define groups:
// groupBy_CASE:To group each `page` of the `pages` by `page.Residencia`
// (Results:)(key=G1.key)(values=G1.rows)
//
// Each `G1.key` is a value from the `page.Residencia`.
// Each `G1.rows` is an Array of JavaScript Objects.
//
// (comments)sort_CASE:To sort each `G1.rows` of the `G1` by `G1.key` in descending order
//
// groupIn_CASE:To group each `G1.rows` of the `G1` by `G1.rows.Clan`
// (Results:)(key=G2.key)(values=G2.rows=G1.rows.rows)
//
// Each `G2.key` is a value from the `G1.rows.Clan`.
// Each `G2.rows` is an Array of JavaScript Objects.
//
// The Bottom Level(Grouped Twice): `G2`=`G1.rows`; `G2.rows`=`page`
// #####################################################################
let groups = pages
.groupBy((page) => page.Residencia) // groupBy: (default) in ascending order
// .sort((G1) => G1.key, "desc")
.groupIn((G1) => G1.Clan); // groupIn: (default) in ascending order
// D30. 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");
// D51. output groups:
// #####################################################################
for (let G1 of groups) {
// D31.FR10 output G1.key: H3
// G1.key: the value of the `Residencia` field
// Q16_GroupIn_CASE: "BUENOS AIRES", "PARIS", "USA"
// #####################################################################
dv.header(3, G1.key);
// D31.FR12 sort G1.rows: in descending order
// G1.rows.key: the value of the `Clan` field
// Q16_GroupIn_CASE: "Malkavian", "Toreador", "Tremere", "Ventrue"
// G2.key=G1.rows.key
// #####################################################################
// G1.rows = G1.rows.sort((G2) => G2.key, "desc");
// D31.FR20 output G1.rows:
// #####################################################################
for (let G2 of G1.rows) {
// D31.FR20.FR11 output G2.key: H6
// Q16_GroupIn_CASE: "Malkavian", "Toreador", "Tremere", "Ventrue"
// #####################################################################
dv.header(6, G2.key);
// D31.FR20.FR51 output page: TABLE
// #####################################################################
// Display the result as a table
dv.table(
["Cainita", "Generacion", "Status", "Link"],
G2.rows
.sort((page) => page.Cainita, "asc")
.map((page) => [
page.Cainita,
page.Generacion,
page.Status,
page.file.link,
])
);
}
}
```
Screenshots(DVJS20_A3_31)