The file.lists by example - Chapter 5: using DQL to gather list items or task items under the specific heading (and filter by L.text)(and filter by L.task or !L.task)(and filter by L.tags or L.outlinks) without the desired structure and shorten the display name of the L.header (and group by L.header)(and group by file.link)
Summary
How to gather list items or task items under the specific heading without the desired structure?
DQL10:
GROUP BY L.header AS G_L_header
To shorten the display name of the L.header
DQL20:
GROUP BY L.header AS G_L_header, GROUP BY rows.file.link AS G_fLink
To shorten the display name of the L.header
DQL30:
GROUP BY L.header AS G_L_header, GROUP BY "### " + rows.file.link[0] AS G_fLink
To shorten the display name of the L.header
The DQL30 is very similar to the DVJS10 with Another Example13B in the following topic. - Solutions: by Justdoitcc
The DQL30 displays one list item(or one task item) where L.text matches the WHERE contains(L.text, "1") OR contains(L.text, "2") expression. However, the DVJS10 in the topic (Chapter 4) displays one root list item(or one root task item) with its children.
---
Date: 1995-03-01
---
### input_data
#### a
- a1
- a2
#### b
- b1
- b2
#### c
- [x] c1
- [ ] c2
#### d
- [ ] d1
- [x] d2
#### e
- [!] e1
- [ ] e2
#### f
folder: 04
filename : dic_19950401
---
Date: 1995-04-01
---
### input_data
#### a
- a1
- a2
#### b
- b1
- b2
#### c
- [>] c1
- [ ] c2
#### d
- [x] d1
- [ ] d2
#### e
- [ ] e1
- [x] e2
#### f
DQL10_get_unique_links_of_headings_and_TABLE
Summary
Main DQL
Code Name
Data type
Group By
Purposes
Remark
DQL10 _get_unique_links _of_headings _and_TABLE
file.lists
yes
1.To flatten file.lists 2.To gather the links of the headers where each of the headings contains at least one list item or one task item 3.To filter by L.text 4.To group by L.header and let G_L_header = rows.L.header; (key=G1.key, values=G1.rows) 5.To display the result as a table
The DQL10 is based on DQL90 in the following topic. - Solutions: by Justdoitcc
Notes
Summary
The same codes:
After the following expression:
```SQL
GROUP BY L.header AS G_L_header
```
Original Example10
```SQL
TABLE WITHOUT ID
G_L_header AS "G_L_header",
```
Another Example11
```SQL
TABLE WITHOUT ID
rows.L.header[0] AS "G_L_header",
```
Another Example12
```SQL
TABLE WITHOUT ID
key AS "G_L_header",
```
Code DQL10_get_unique_links_of_headings_and_TABLE
Summary_code
title: DQL10_get_unique_links_of_headings_and_TABLE =>1.To flatten file.lists 2.To gather the links of the headers where each of the headings contains at least one list item or one task item 3.To filter by L.text 4.To group by L.header and `let G_L_header = rows.L.header;` (key=G1.key, values=G1.rows) 5.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
G_L_header AS "G_L_header",
map(rows.L.header, (e) => link(e, meta(e).subpath))[0] AS "Heading",
rows.F_subpath[0] AS "F_subpath",
map(rows.L, (L) => choice(L.task, "- [" + L.status + "] " + L.text, "- " + L.text)) AS "L.text"
FROM "100_Project/01_dataviewjs/01_by_example/Q88_header/Q88_test_data"
FLATTEN file.lists AS L
FLATTEN meta(L.header).subpath AS F_subpath
FLATTEN meta(L.header).type AS F_type
WHERE contains(L.text, "1")
WHERE F_type = "header"
GROUP BY L.header AS G_L_header
```
1.To flatten file.lists 2.To gather the links of the headers where each of the headings contains at least one list item or one task item 3.To filter by L.text 4.To groupBy L.header and let G_L_header = rows.L.header; (key=G1.key, values=G1.rows) 5.To groupIn rows.file.link and let G_fLink = rows.file.link; (key=G2.key, values=G2.rows) 6.To display the result as a table
The DQL20 is based on DQL10 in the topic.
Notes
Summary
The same codes:
After the following expression:
```SQL
GROUP BY L.header AS G_L_header
GROUP BY rows.file.link AS G_fLink
```
Original Example10
```SQL
TABLE WITHOUT ID
G_fLink[0] AS "File",
```
Another Example11
```SQL
TABLE WITHOUT ID
rows.rows.file.link[0][0] AS "File",
```
title: DQL20_get_unique_links_of_headings_and_groupIn_fLink_and_TABLE =>1.To flatten file.lists 2.To gather the links of the headers where each of the headings contains at least one list item or one task item 3.To filter by L.text 4.To groupBy L.header and `let G_L_header = rows.L.header;` (key=G1.key, values=G1.rows) 5.To groupIn rows.file.link and `let G_fLink = rows.file.link;` (key=G2.key, values=G2.rows) 6.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
G_fLink[0] AS "File",
rows.G_L_header AS "G_L_header",
map(rows.G_L_header, (e) => link(e, meta(e).subpath)) AS "Heading",
map(rows.rows.L, (L) => choice(L.task, "- [" + L.status + "] " + L.text, L.text)) AS "L.text"
FROM "100_Project/01_dataviewjs/01_by_example/Q88_header/Q88_test_data"
FLATTEN file.lists AS L
WHERE contains(L.text, "1")
FLATTEN meta(L.header).subpath AS F_subpath
FLATTEN meta(L.header).type AS F_type
WHERE F_type = "header"
GROUP BY L.header AS G_L_header
GROUP BY rows.file.link AS G_fLink
```
1.To flatten file.lists 2.To gather the links of the headers where each of the headings contains at least one list item or one task item 3.To filter by L.text 4.To groupBy L.header and let G_L_header = rows.L.header; (key=G1.key, values=G1.rows) 5.To groupIn rows.file.link and let G_fLink = rows.file.link; (key=G2.key, values=G2.rows) 6.To display the result as a table
1.The DQL30 is based on the DQL20 in the topic.
2.The DQL30 is very similar to the DVJS10 with Another Example13B in the following topic. - Solutions: by Justdoitcc
Notes
Summary
To modify the code
EX10: Original Example10
Summary_EX10
To gather list items or task items under any heading
To gather items where L.text contains “1” or “2”
```SQL
WHERE F_type = "header"
WHERE contains(L.text, "1") OR contains(L.text, "2")
```
EX11: Another Example11
Summary_EX11
To gather list items or task items under the heading where the heading contains “Question”
To gather items where L.text contains “breakfast” or “dinner”
```SQL
WHERE F_subpath = "Question" AND F_type = "header"
WHERE contains(L.text, "breakfast") OR contains(L.text, "dinner")
```
EX12: Another Example12
Summary_EX12
To gather list items or task items under the heading where the heading contains “Question”
To gather a task item where it is not fullyCompleted or To gather a list item where L.text contains “breakfast”
```SQL
WHERE F_subpath = "Question" AND F_type = "header"
WHERE (L.task AND !L.fullyCompleted) OR (!L.task AND contains(L.text, "breakfast")
```
EX13A: Another Example13A
Summary_EX13A
To gather list items or task items under the heading where the heading contains “Question”
To gather items where L.text contains “breakfast” or “dinner” or “feature”
```SQL
WHERE F_subpath = "Question" AND F_type = "header"
WHERE contains(L.text, "breakfast") OR contains(L.text, "dinner") OR contains(L.text, "feature")
```
EX13B: Another Example13B
Summary_EX13B
To gather list items or task items under any heading
To gather items where L.text contains “breakfast” or “dinner” or “feature”
```SQL
WHERE F_type = "header"
WHERE contains(L.text, "breakfast") OR contains(L.text, "dinner") OR contains(L.text, "feature")
```
EX14: Another Example14
Summary_EX14
To gather list items or task items under the heading where the heading contains “Question” with the desired structure
To gather items where L.tags contains “#Test/d05” or To gather items where L.outlinks contains “[[Note K]]”
```SQL
WHERE F_subpath = "Question" AND F_type = "header"
WHERE contains(L.tags, "#Test/d05") OR contains(L.outlinks, [[Note K]])
```
title: DQL30_get_unique_links_of_headings_and_groupIn_fLink_and_LIST =>1.To flatten file.lists 2.To gather the links of the headers where each of the headings contains at least one list item or one task item 3.To filter by L.text 4.To groupBy L.header and `let G_L_header = rows.L.header;` (key=G1.key, values=G1.rows) 5.To groupIn rows.file.link and `let G_fLink = rows.file.link;` (key=G2.key, values=G2.rows) 6.To display the result as a list
collapse: close
icon:
color:
```dataview
LIST
map(rows, (e) =>
link(e.G_L_header, meta(e.G_L_header).subpath) +
"<br>" +
join(
map(e.rows.L, (L) =>
choice(!L.task, "⦁ " + L.text,
choice(L.task AND !L.completed AND !L.checked, "□ " + L.text,
choice(L.task AND !L.completed AND L.checked, "⚠ " + L.text,
choice(L.task AND L.completed,
"▣ " + "~~" + L.text + "~~",
L.text
)
)
)
)
),
"<br>"
)
)
FROM "100_Project/01_dataviewjs/01_by_example/Q88_header/Q88_test_data"
FLATTEN file.lists AS L
FLATTEN meta(L.header).subpath AS F_subpath
FLATTEN meta(L.header).type AS F_type
WHERE F_type = "header"
WHERE contains(L.text, "1") OR contains(L.text, "2")
GROUP BY L.header AS G_L_header
GROUP BY "### " + rows.file.link[0] AS G_fLink
```
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)
The file.lists by example - Chapter 3: using DQL to gather list items or task items under the specific heading (and filter by a field) (and sum up a field) (and display each DVIF)
The file.lists by example - Chapter 4: using DQL(or DVJS) to gather list items or task items under the specific heading (and filter by L.text)(and filter by L.task or !L.task)(and filter by L.tags or L.outlinks) without(or with) the desired structure
But, the situation is a little different.
What I want to do is linking to the headers which are “generated by dv.header()”, not creating the links by dv.header().