Topic : 1/2
Summary
- How to compare the
org
field whch is an array of links or an array of strings to thealiases
field whch is an array of strings? (DQL10
,DVJS10
)
Before you use the meta function, you have to transform a string like “Org One” into a link like “[[Org One]]”. Otherwise, the file like dic_19630330 will not be taken into consideration in any DQL.
Test
Summary
- dataview: v0.5.46
Input
Summary
dictionary files: Organizations
Summary_O
- Location: “100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Organizations”
folder: Test
- filename :
Org One Test
---
name: "Org One"
aliases:
- "Org One"
- "Org One Alias"
---
### DQL01
### DQL03
### DQL10
### DVJS10
folder: Another
“Another Org” = “Org One X” = “Org Two Y”
- filename :
Another Org
---
name: "Another Org"
aliases:
- "Org One X"
- "Org Two Y"
- "Another Org"
---
- filename :
Org One X
---
name: "Org One X"
aliases:
- "Org One X"
- "Org Two Y"
- "Another Org"
---
- filename :
Org Two Y
---
name: "Org Two Y"
aliases:
- "Org One X"
- "Org Two Y"
- "Another Org"
---
folder: Some
“Some Org” = “Org One” = “Org Two”
- filename :
Some Org
---
name: "Some Org"
aliases:
- "Org One"
- "Org Two"
---
- filename :
Org One
---
name: "Org One"
aliases:
- "Org One"
- "Org Two"
---
- filename :
Org Two
---
name: "Org Two"
aliases:
- "Org One"
- "Org Two"
---
dictionary files: Persons
Summary_P
- Location: “100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Persons”
folder: 03_String
- filename :
dic_19630330
---
Date: 1963-03-30
name: "March"
job_title: "engineer"
org:
- "Org One"
- "Org Two"
---
folder: 04_Link_with_display
- filename :
dic_19630401
---
Date: 1963-04-01
name: "April"
job_title: "manager"
org:
- "[[Some Org| Org One]]"
- "[[Some Org| Org Two]]"
---
folder: 07_Link_without_display
- filename :
dic_19630707
---
Date: 1963-07-07
name: "July"
job_title: "operator"
org:
- "[[Org One]]"
- "[[Org Two]]"
---
folder: 09_Link_with_path
- filename :
dic_19630912
---
Date: 1963-09-12
name: "September"
job_title: "CEO"
org:
- "[[100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Organizations/Some/Org One.md]]"
- "[[100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Organizations/Some/Org Two.md]]"
---
folder: 11_excluding_String
- filename :
dic_19631130
---
Date: 1963-11-30
name: "November"
job_title: "principal"
org:
- "Org One X"
- "Org Two Y"
- "Another Org"
---
folder: 12_excluding_Link
- filename :
dic_19631201
---
Date: 1963-12-01
name: "December"
job_title: "teacher"
org:
- "[[Another Org| Org One X]]"
- "[[Another Org| Org Two Y]]"
---
- filename :
dic_19631207
---
Date: 1963-12-07
name: "December"
job_title: "teacher"
org:
- "[[Org One X]]"
- "[[Org Two Y]]"
- "[[Another Org]]"
---
- filename :
dic_19631212
---
Date: 1963-12-12
name: "December"
job_title: "teacher"
org:
- "[[100_Project/22_DVJS/V01_CF/V01_T/Organizations/Another/Org One X.md]]"
- "[[100_Project/22_DVJS/V01_CF/V01_T/Organizations/Another/Org Two Y.md]]"
- "[[100_Project/22_DVJS/V01_CF/V01_T/Organizations/Another/Another Org.md]]"
---
DQL01_deal_with_an_array_of_lnks_and_TABLE
Summary
Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL01 _deal_with _an_array_of_lnks _and_TABLE |
org :an array of lnks |
no | 1.To filter by org 2.To break up the list org into each individual element like Organization 3.To break up the list this.file.aliases into each individual element like Alias 4.To define a field variable H with assigning the value as meta(Organization) 5.To define a field variable P_display with removing the leading whitespaces of the H.display 6.To define a field variable Q_path with getting the filename of the H.path 7.To filter by typeof(Organization) 8.To filter by upper(P_display) or upper(Q_path) 9.To sort by name (“ASC”) 10.To display the result as a table |
Code DQL01_deal_with_an_array_of_lnks_and_TABLE
Summary_code
title: DQL01_deal_with_an_array_of_lnks_and_TABLE =>1.To filter by `org` 2.To break up the list `org` into each individual element like `Organization` 3.To break up the list `this.file.aliases` into each individual element like `Alias` 4.To define a field variable `H` with assigning the value as `meta(Organization)` 5.To define a field variable `P_display` with removing the leading whitespaces of the `H.display` 6.To define a field variable `Q_path` with getting the filename of the `H.path` 7.To filter by `typeof(Organization)` 8.To filter by `upper(P_display)` or `upper(Q_path)` 9.To sort by `name`("ASC") 10.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
link(file.path, name) AS "Name",
job_title AS "Job Title",
Organization AS "Organization",
Alias AS "Alias",
P_display AS "P_display",
Q_path AS "Q_path"
FROM "100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Persons"
WHERE org
FLATTEN org AS Organization
FLATTEN this.file.aliases AS Alias
FLATTEN meta(Organization) AS H
FLATTEN regexreplace(H.display, "^\s*", "") AS P_display
FLATTEN regexreplace(H.path, "^(.*/)(.+)(.md)$", "$2") AS Q_path
WHERE typeof(Organization) = "link"
WHERE upper(P_display) = upper(Alias) OR
upper(Q_path) = upper(Alias)
SORT name ASC
```
Screenshots(DQL01)
DQL03_deal_with_an_array_of_strings_and_TABLE
Summary
Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL03 _deal_with _an_array_of_strings _and_TABLE |
org :an array of strings |
no | 1.To filter by org 2.To break up the list org into each individual element like Organization 3.To break up the list this.file.aliases into each individual element like Alias 4.To filter by typeof(Organization) 5.To filter by upper(P_display) or upper(Q_path) 6.To sort by name (“ASC”) 7.To display the result as a table |
Code DQL03_deal_with_an_array_of_strings_and_TABLE
Summary_code
title: DQL03_deal_with_an_array_of_strings_and_TABLE =>1.To filter by `org` 2.To break up the list `org` into each individual element like `Organization` 3.To break up the list `this.file.aliases` into each individual element like `Alias` 4.To filter by `typeof(Organization)` 5.To filter by `upper(P_display)` or `upper(Q_path)` 6.To sort by `name`("ASC") 7.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
link(file.path, name) AS Name,
job_title AS "Job Title",
Organization AS "Organization",
Alias AS "Alias"
FROM "100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Persons"
WHERE org
FLATTEN org as Organization
FLATTEN this.file.aliases as Alias
WHERE typeof(Organization) = "string"
WHERE upper(Organization) = upper(Alias)
SORT name ASC
```
Screenshots(DQL03)
DQL10_deal_with_an_array_of_lnks_or_strings_and_TABLE
Summary
Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL10 _deal_with _an_array_of _lnks_or_strings _and_TABLE |
org :1.an array of lnks 2.an array of strings |
no | 1.To filter by org 2.To break up the list org into each individual element like Organization 3.To break up the list this.file.aliases into each individual element like Alias 4.To define a field variable LINK with transforming Organization into a link 5.To define a field variable H with assigning the value as meta(LINK) 6.To define a field variable P_display with removing the leading whitespaces of the H.display 7.To define a field variable Q_path with getting the filename of the H.path 8.To filter by upper(P_display) or upper(Q_path) 9.To sort by name (“ASC”) 10.To display the result as a table |
1.The DQL10 does what both the DQL01 and DQL03 do. 2.The Purposes 4 is the key idea. 2.1 Before you use the meta function, you have to transform a string like “Org One” into a link like “[[Org One]]”. Otherwise, the file like dic_19630330 will not be taken into consideration in any DQL.3.The Regular Expression declared as a variable like Q_path in the DQL10 is based on the DQL10 in the following topic.- Solutions: by Justdoitcc |
Notes
Summary
Q1: How to modify the following code with simplifying the content of the file like dic_19630401
?
Summary_Q1
Original Example: Q1 (To be modified)
```dataview
FLATTEN regexreplace(H.display, "^\s*", "") AS P_display
```
folder: 04_Link_with_display (To be modified)
- filename :
dic_19630401
(To be modified)
---
Date: 1963-04-01
name: "April"
job_title: "manager"
org:
- "[[Some Org| Org One]]"
- "[[Some Org| Org Two]]"
---
A1:
Another Example: A1_11
```dataview
FLATTEN H.display AS P_display
```
folder: 04_Link_with_display (After being modified)
There are no whitespaces on either side of the symbol like “|”.
- filename :
dic_19630401
(After being modified)
---
Date: 1963-04-01
name: "April"
job_title: "manager"
org:
- "[[Some Org|Org One]]"
- "[[Some Org|Org Two]]"
---
Code DQL10_deal_with_an_array_of_lnks_or_strings_and_TABLE
Summary_code
title: DQL10_deal_with_an_array_of_lnks_or_strings_and_TABLE =>1.To filter by `org` 2.To break up the list `org` into each individual element like `Organization` 3.To break up the list `this.file.aliases` into each individual element like `Alias` 4.To define a field variable `LINK` with transforming `Organization` into a link 5.To define a field variable `H` with assigning the value as `meta(LINK)` 6.To define a field variable `P_display` with removing the leading whitespaces of the `H.display` 7.To define a field variable `Q_path` with getting the filename of the `H.path` 8.To filter by `upper(P_display)` or `upper(Q_path)` 9.To sort by `name`("ASC") 10.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
link(file.path, name) AS "Name",
job_title AS "Job Title",
Organization AS "Organization",
Alias AS "Alias",
P_display AS "P_display",
Q_path AS "Q_path"
FROM "100_Project/02_dataview/Q24_MetaFunction/Q24_test_data/Persons"
WHERE org
FLATTEN org as Organization
FLATTEN this.file.aliases as Alias
FLATTEN choice(typeof(Organization) = "string", link(Organization) ,Organization) AS LINK
FLATTEN meta(LINK) AS H
FLATTEN regexreplace(H.display, "^\s*", "") AS P_display
FLATTEN regexreplace(H.path, "^(.*/)(.+)(.md)$", "$2") AS Q_path
WHERE upper(P_display) = upper(Alias) OR
upper(Q_path) = upper(Alias)
SORT name ASC
```