Topic
Summary
- How to get the filename of a link inside a metadata field?
Test
Summary
- dataview: v0.5.55
Input
Summary
the related files
- Location: “100_Project/02_dataview/Q88_Links/Q88_test_data/01”
- filename :
company - Apple
---
Date: 2000-01-01
---
- filename :
company - Coffee
=>It does not exist.
dictionary files
- Location: “100_Project/02_dataview/Q88_Links/Q88_test_data”
folder: 03
- filename :
dic_20000301
---
Date: 2000-03-01
---
active :: yes
up :: [[company - Apple]]
folder: 04
- filename :
dic_20000401
---
Date: 2000-04-01
---
active :: yes
up :: [[company - Coffee]]
folder: 06_null
- filename :
dic_20000601
---
Date: 2000-06-01
---
active :: yes
up ::
folder: 07_string_excluded
- filename :
dic_20000701
---
Date: 2000-07-01
---
active :: yes
up :: tea
DQL10_get_the_filename_of_a_link_and_TABLE
Summary
Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL10_get_the_filename _of_a_link _and_TABLE |
up :a link |
no | 1.To filter by active 2.To filter by up 3.To define a field variable s_filename_of_link 4.To sort by file.link in ascending order 5.To display the result as a table |
3.The prefix s before the field variable s_filename_of_link means that the data type of the variable is a String . |
Q1: What does the following DQL statement mean?
Summary_Q
Original Example: Q1 (To be explained)
```dataview
FLATTEN regexreplace(meta(up).path, "^(.*/)(.+)(\.md)$", "$2") AS s_filename_of_link
```
A1_11:
Another Example: A1_11
NOTE:To get the filename of a link
```dataview
// In English:
// To define a field variable `s_filename_of_link` in each page as the expression like `regexreplace(meta(up).path, "^(.*/)(.+)(\.md)$", "$2")` by using `FLATTEN`
//
// In other words:
// let page.s_filename_of_link = regexreplace(meta(up).path, "^(.*/)(.+)(\.md)$", "$2");
FLATTEN regexreplace(meta(up).path, "^(.*/)(.+)(\.md)$", "$2") AS s_filename_of_link
```
DQL10_get_the_filename_of_a_link_and_TABLE
Summary_code
title: DQL10_get_the_filename_of_a_link_and_TABLE =>1.To filter by `active` 2.To filter by `up` 3.To define a field variable `s_filename_of_link` 4.To sort by file.link in ascending order 5.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
file.link AS "element",
up AS "up",
regexreplace(s_filename_of_link, "^company -", "") as "company"
FROM "100_Project/02_dataview/Q88_Links/Q88_test_data"
WHERE active = "yes"
WHERE up != null
FLATTEN regexreplace(meta(up).path, "^(.*/)(.+)(\.md)$", "$2") AS s_filename_of_link
SORT file.link ASC
```