Two questions before Iโm able to tackle that query, what is the actual name of your Author
notes, is it โKing, Stephenโ (or โStephen Kingโ)? And how do you list multiple authors now in a Book
note?
You are amazing! You both are!! Just changing the WHERE
to
WHERE meta(Author).display = this.Alias
was enough to make it work.
WHERE contains(meta(Author).display, this.Alias)
also seems to work. However this doesnโt work for books with multiple authors. (see comment below)
So, the author notes are โKing, Stephenโ.
And books with multiple authors seem to be an issue with the above solution. The creator of the frontmatter links plugin (Multiple links in one line? ยท Issue #22 ยท Trikzon/obsidian-frontmatter-links ยท GitHub) told me to do multiple authors like this:
Author: ["[[King, Stephen|Stephen King]]", "[[Toliken, J.R.R.|J.R.R. Tolkien]]"]
or
Author:
- "[[King, Stephen|Stephen King]]"
- "[[Toliken, J.R.R.|J.R.R. Tolkien]]"
but this doesnโt seem to work with the solution from @justdoitcc as cool as it is.
Frippin joy.
WHERE meta(Author).display = this.Alias
I got sooooooooo close to that several times but kept on missing the sweet spot. Brilliant answers.
Indeed!! I now just need to find a way for this to work if there are multiple authorsโฆ But thanks all around!!
But Dataview can interpret a value as a link, yes?
Links in YAML Frontmatter
If you reference a link in frontmatter, you need to quote it, as so:key: "[[Link]]"
. This is default Obsidian-supported behaviour. Unquoted links lead to invalid YAML frontmatter that cannot be parsed.
parent: "[[parentPage]]"
Please be aware that this is only a link for dataview, but not for Obsidian anymore - that means it wonโt show up in the outgoing links, wonโt be displayed on graph view and wonโt be updated on i.e. a rename.
I think thatโs what the plugin I linked does: it links links formatted like that in the usual way. Iโ not sure though.
This is confusing, but what you say here is a key point. Dataview can interpret it as links.
Also the last paragraph of your quote is crucial: when renaming notes these fields are not updated, nor show up in graph view or as backlinks.
It seems like that this Frontmatter links plugin tries to address these issues. Iโve not used it and canโt vouch for its correctness.
All my other comments are done without considering any effects that plugin might infere.
The link thing is definitely a grey and fuzzy issue. Think Datacore is going to be quite a shakeup, given what the roadmap says.
God helg
So I made myself some books, which are enclosed in the next collapsed section.
My library of books
I made five books, with the content under the file name header:
King of Obsidian
---
Author: "[[King, Stephen|Stephen King]]"
Year: 2023
---
Hobbit King
---
Author: ["[[King, Stephen|Stephen King]]","[[Tolkien, J.R.R|J.R.R. Tolkien]]"]
Year: 2024
---
Hobbit King II
---
Author:
- "[[King, Stephen|Stephen King]]"
- "[[Tolkien, J.R.R|J.R.R. Tolkien]]"
Year: 2024
---
King of the Folders
---
Author:
- "[[King, Stephen|Stephen King]]"
Year: 2025
---
No Alias King
---
Author:
- "[[King, Stephen]]"
Year: 2025
---
Note how the different books, uses slight variations of how to present the authors, with the final book not presenting an alias for the author.
The one and only Stephen King
King, Stephen
---
Alias: Stephen King
---
### Using FLATTEN and ECONTAINS on alias
```dataview
TABLE Author, Year, this.alias, meta(OneAuthor).path, meta(OneAuthor).display
FLATTEN Author as OneAuthor
WHERE file.folder = this.file.folder
WHERE econtains(meta(OneAuthor).display, this.alias)
```
### Using FILTER on alias
```dataview
TABLE Author, Year, this.alias
WHERE file.folder = this.file.folder
WHERE Author AND filter(Author, (a) => meta(a).display = this.alias)
```
### Using FLATTEN and ECONTAINS on file path
```dataview
TABLE Author, meta(OneAuthor).path
FLATTEN Author as OneAuthor
WHERE file.folder = this.file.folder
WHERE Author AND econtains(meta(OneAuthor).path, this.file.path)
```
### Using FILTER on file path
```dataview
TABLE Author, Year
WHERE file.folder = this.file.folder
WHERE Author AND filter(Author, (a) => meta(a).path = this.file.path)
```
In the previous section, Iโve included four queries, which outputs the following:
The scripts uses either a combination of FLATTEN
and econtains
or just a filter
on the entire Author
field. The two first matches against the meta( ... ).display
part, aka the aliased version, and the last two matches against the actual file path to the note, aka the meta( ... ).path
part.
The two last ones are the only one showing the book โNo Alias Kingโ, since that doesnโt use an aliased link as the Author. A similar case could be if you type the wrong alias, so I would recommend using the file path version, as itโs a given where the file path is, but you donโt really know which alias someone wants to use for an author. In addition, that would also allow for multiple pseudonyms (or aliases) to be used for any author.
So there you have some script alternatives, which should be adaptable to your case, and ready for use. As the files and query here are presented as something ready to run as long as you place all files in the same folder, you need to change the first WHERE
clause of the scripts, to match your settings. (Or exchange it with a FROM
(which needs to be before any FLATTEN
lines)
Adding
FLATTEN Author as OneAuthor
WHERE Author AND econtains(meta(OneAuthor).path, this.file.path)
works! So I marked it as the solution, just another question, none of your file.folder
work, though I think theyโre not necessary? But what were they meant to do?
Thanks a bunch!
They were used to make my code a self contained example. It limits the query to only use files in the current folder.
So theyโre not necessary in your case, thatโs correct.
Ah OK, that makes sense Thank you!!
Just in case anyoneโs interested, Iโve now implemented that into my crazy query:
TABLE without id
("![](" + Cover + ")") AS "Cover",
P_BookByAuthor + P_MediumIcon + P_FavoriteIcon AS "Title",
Q_YearRating + Q_PagesHours + " || " + Q_FLAG AS "Time and Place",
R_Dates AS "Dates",
"(" + S_ReadingTime + " || " + S_ReadingSpeed + ")" AS "Reading Time"
FROM "Book Log" OR "Y Movies and Games" OR "0 Currently Reading" OR "Set Aside"
FLATTEN {
"Book": Author,
"Audiobook": Author,
"Podcast": Author,
"eBook": Author,
"AcademicBook": Author,
"AcademicArticle": Author,
"GraphicNovel": Author,
"Movie": Director,
"TV": Director,
"Game": Director
}[Medium] AS OneAuthor
WHERE econtains(meta(OneAuthor).path, this.file.path)
SORT DateFinished asc
FLATTEN link(file.link, Alias) + " by " + OneAuthor AS P_BookByAuthor
FLATTEN choice(contains(tags, "Favorite"), "๐", "") AS P_FavoriteIcon
FLATTEN {
"Book": " ๐ ",
"Audiobook": " ๐ง ",
"Podcast": " ๐ป ",
"eBook": " ๐ ",
"AcademicBook": " ๐๐ ",
"AcademicArticle": " ๐ฐ ",
"GraphicNovel": " ๐ฌ ",
"Movie": " ๐๏ธ ",
"TV": " ๐บ ",
"Game": " ๐ฎ "
}[Medium] AS P_MediumIcon
FLATTEN DateStarted + " โ " + DateFinished AS R_Dates
FLATTEN choice(((DateFinished - DateStarted).days = 1), "1 day", choice((DateFinished != DateStarted), (DateFinished - DateStarted).days + " days", "0 days" )) AS S_ReadingTime
FLATTEN {
"Book": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 1) + " p/d",
"Audiobook": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 2) + " h/d",
"Podcast": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 2)+ " h/d",
"eBook": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 1) + " p/d",
"GraphicNovel": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 1) + " p/d",
"AcademicBook": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 1) + " p/d",
"AcademicArticle": round(choice((DateFinished = DateStarted), Length, (Length / (DateFinished - DateStarted).days)), 1) + " p/d",
"Movie": round(choice((DateFinished = DateStarted), round((Length/60), 1), (Length / (DateFinished - DateStarted).days)), 1) + " h/d",
"TV": round(choice((DateFinished = DateStarted), round((Length/60), 1), (Length / (DateFinished - DateStarted).days)), 1) + " h/d",
"Game": round(choice((DateFinished = DateStarted), round((Length/60), 1), (Length / (DateFinished - DateStarted).days)), 1) + " h/d"
}[Medium] AS S_ReadingSpeed
FLATTEN Year + " || " + " โญ " + Rating + " || " AS Q_YearRating
FLATTEN {
"Book": Length + " p",
"Audiobook": Length + " h",
"Podcast": Length + " h",
"eBook": Length + " p",
"GraphicNovel": Length + " p",
"AcademicBook": Length + " p",
"AcademicArticle": Length + " p",
"Movie": round((Length/60), 1) + " h",
"TV": round((Length/60), 1) + " h",
"Game": round((Length/60), 1) + " h"
}[Medium] AS Q_PagesHours
FLATTEN join(map(split(Country, ", "), (c) => {
AD: "๐ฆ๐ฉ",
AE: "๐ฆ๐ช",
AF: "๐ฆ๐ซ",
AG: "๐ฆ๐ฌ",
AI: "๐ฆ๐ฎ",
AL: "๐ฆ๐ฑ",
AM: "๐ฆ๐ฒ",
AO: "๐ฆ๐ด",
AQ: "๐ฆ๐ถ",
AR: "๐ฆ๐ท",
AS: "๐ฆ๐ธ",
AT: "๐ฆ๐น",
AU: "๐ฆ๐บ",
AW: "๐ฆ๐ผ",
AX: "๐ฆ๐ฝ",
AZ: "๐ฆ๐ฟ",
BA: "๐ง๐ฆ",
BB: "๐ง๐ง",
BD: "๐ง๐ฉ",
BE: "๐ง๐ช",
BF: "๐ง๐ซ",
BG: "๐ง๐ฌ",
BH: "๐ง๐ญ",
BI: "๐ง๐ฎ",
BJ: "๐ง๐ฏ",
BL: "๐ง๐ฑ",
BM: "๐ง๐ฒ",
BN: "๐ง๐ณ",
BO: "๐ง๐ด",
BQ: "๐ง๐ถ",
BR: "๐ง๐ท",
BS: "๐ง๐ธ",
BT: "๐ง๐น",
BV: "๐ง๐ป",
BW: "๐ง๐ผ",
BY: "๐ง๐พ",
BZ: "๐ง๐ฟ",
CA: "๐จ๐ฆ",
CC: "๐จ๐จ",
CD: "๐จ๐ฉ",
CF: "๐จ๐ซ",
CG: "๐จ๐ฌ",
CH: "๐จ๐ญ",
CI: "๐จ๐ฎ",
CK: "๐จ๐ฐ",
CL: "๐จ๐ฑ",
CM: "๐จ๐ฒ",
CN: "๐จ๐ณ",
CO: "๐จ๐ด",
CR: "๐จ๐ท",
CU: "๐จ๐บ",
CV: "๐จ๐ป",
CW: "๐จ๐ผ",
CX: "๐จ๐ฝ",
CY: "๐จ๐พ",
CYMRU: "๐ด๓ ง๓ ข๓ ท๓ ฌ๓ ณ๓ ฟ",
CZ: "๐จ๐ฟ",
DE: "๐ฉ๐ช",
DJ: "๐ฉ๐ฏ",
DK: "๐ฉ๐ฐ",
DM: "๐ฉ๐ฒ",
DO: "๐ฉ๐ด",
DZ: "๐ฉ๐ฟ",
EC: "๐ช๐จ",
EE: "๐ช๐ช",
EG: "๐ช๐ฌ",
EH: "๐ช๐ญ",
ENG: "๐ด๓ ง๓ ข๓ ฅ๓ ฎ๓ ง๓ ฟ",
ER: "๐ช๐ท",
ES: "๐ช๐ธ",
ET: "๐ช๐น",
FI: "๐ซ๐ฎ",
FJ: "๐ซ๐ฏ",
FK: "๐ซ๐ฐ",
FM: "๐ซ๐ฒ",
FO: "๐ซ๐ด",
FR: "๐ซ๐ท",
GA: "๐ฌ๐ฆ",
GB: "๐ฌ๐ง",
GD: "๐ฌ๐ฉ",
GE: "๐ฌ๐ช",
GF: "๐ฌ๐ซ",
GG: "๐ฌ๐ฌ",
GH: "๐ฌ๐ญ",
GI: "๐ฌ๐ฎ",
GL: "๐ฌ๐ฑ",
GM: "๐ฌ๐ฒ",
GN: "๐ฌ๐ณ",
GP: "๐ฌ๐ต",
GQ: "๐ฌ๐ถ",
GR: "๐ฌ๐ท",
GS: "๐ฌ๐ธ",
GT: "๐ฌ๐น",
GU: "๐ฌ๐บ",
GW: "๐ฌ๐ผ",
GY: "๐ฌ๐พ",
HK: "๐ญ๐ฐ",
HM: "๐ญ๐ฒ",
HN: "๐ญ๐ณ",
HR: "๐ญ๐ท",
HT: "๐ญ๐น",
HU: "๐ญ๐บ",
ID: "๐ฎ๐ฉ",
IE: "๐ฎ๐ช",
IL: "๐ฎ๐ฑ",
IM: "๐ฎ๐ฒ",
IN: "๐ฎ๐ณ",
IO: "๐ฎ๐ด",
IQ: "๐ฎ๐ถ",
IR: "๐ฎ๐ท",
IS: "๐ฎ๐ธ",
IT: "๐ฎ๐น",
JE: "๐ฏ๐ช",
JM: "๐ฏ๐ฒ",
JO: "๐ฏ๐ด",
JP: "๐ฏ๐ต",
KE: "๐ฐ๐ช",
KG: "๐ฐ๐ฌ",
KH: "๐ฐ๐ญ",
KI: "๐ฐ๐ฎ",
KM: "๐ฐ๐ฒ",
KN: "๐ฐ๐ณ",
KP: "๐ฐ๐ต",
KR: "๐ฐ๐ท",
KW: "๐ฐ๐ผ",
KY: "๐ฐ๐พ",
KZ: "๐ฐ๐ฟ",
LA: "๐ฑ๐ฆ",
LB: "๐ฑ๐ง",
LC: "๐ฑ๐จ",
LI: "๐ฑ๐ฎ",
LK: "๐ฑ๐ฐ",
LR: "๐ฑ๐ท",
LS: "๐ฑ๐ธ",
LT: "๐ฑ๐น",
LU: "๐ฑ๐บ",
LV: "๐ฑ๐ป",
LY: "๐ฑ๐พ",
MA: "๐ฒ๐ฆ",
MC: "๐ฒ๐จ",
MD: "๐ฒ๐ฉ",
ME: "๐ฒ๐ช",
MF: "๐ฒ๐ซ",
MG: "๐ฒ๐ฌ",
MH: "๐ฒ๐ญ",
MK: "๐ฒ๐ฐ",
ML: "๐ฒ๐ฑ",
MM: "๐ฒ๐ฒ",
MN: "๐ฒ๐ณ",
MO: "๐ฒ๐ด",
MP: "๐ฒ๐ต",
MQ: "๐ฒ๐ถ",
MR: "๐ฒ๐ท",
MS: "๐ฒ๐ธ",
MT: "๐ฒ๐น",
MU: "๐ฒ๐บ",
MV: "๐ฒ๐ป",
MW: "๐ฒ๐ผ",
MX: "๐ฒ๐ฝ",
MY: "๐ฒ๐พ",
MZ: "๐ฒ๐ฟ",
NA: "๐ณ๐ฆ",
NC: "๐ณ๐จ",
NE: "๐ณ๐ช",
NF: "๐ณ๐ซ",
NG: "๐ณ๐ฌ",
NI: "๐ณ๐ฎ",
NL: "๐ณ๐ฑ",
NO: "๐ณ๐ด",
NP: "๐ณ๐ต",
NR: "๐ณ๐ท",
NU: "๐ณ๐บ",
NZ: "๐ณ๐ฟ",
OM: "๐ด๐ฒ",
PA: "๐ต๐ฆ",
PE: "๐ต๐ช",
PF: "๐ต๐ซ",
PG: "๐ต๐ฌ",
PH: "๐ต๐ญ",
PK: "๐ต๐ฐ",
PL: "๐ต๐ฑ",
PM: "๐ต๐ฒ",
PN: "๐ต๐ณ",
PR: "๐ต๐ท",
PS: "๐ต๐ธ",
PT: "๐ต๐น",
PW: "๐ต๐ผ",
PY: "๐ต๐พ",
QA: "๐ถ๐ฆ",
RE: "๐ท๐ช",
RO: "๐ท๐ด",
RS: "๐ท๐ธ",
RU: "๐ท๐บ",
RW: "๐ท๐ผ",
SA: "๐ธ๐ฆ",
SB: "๐ธ๐ง",
SC: "๐ธ๐จ",
SCOT: "๐ด๓ ง๓ ข๓ ณ๓ ฃ๓ ด๓ ฟ",
SD: "๐ธ๐ฉ",
SE: "๐ธ๐ช",
SG: "๐ธ๐ฌ",
SH: "๐ธ๐ญ",
SI: "๐ธ๐ฎ",
SJ: "๐ธ๐ฏ",
SK: "๐ธ๐ฐ",
SL: "๐ธ๐ฑ",
SM: "๐ธ๐ฒ",
SN: "๐ธ๐ณ",
SO: "๐ธ๐ด",
SR: "๐ธ๐ท",
SS: "๐ธ๐ธ",
ST: "๐ธ๐น",
SV: "๐ธ๐ป",
SX: "๐ธ๐ฝ",
SY: "๐ธ๐พ",
SZ: "๐ธ๐ฟ",
TC: "๐น๐จ",
TD: "๐น๐ฉ",
TF: "๐น๐ซ",
TG: "๐น๐ฌ",
TH: "๐น๐ญ",
TJ: "๐น๐ฏ",
TK: "๐น๐ฐ",
TL: "๐น๐ฑ",
TM: "๐น๐ฒ",
TN: "๐น๐ณ",
TO: "๐น๐ด",
TR: "๐น๐ท",
TT: "๐น๐น",
TV: "๐น๐ป",
TW: "๐น๐ผ",
TZ: "๐น๐ฟ",
UA: "๐บ๐ฆ",
UG: "๐บ๐ฌ",
UM: "๐บ๐ฒ",
US: "๐บ๐ธ",
UY: "๐บ๐พ",
UZ: "๐บ๐ฟ",
VA: "๐ป๐ฆ",
VC: "๐ป๐จ",
VE: "๐ป๐ช",
VG: "๐ป๐ฌ",
VI: "๐ป๐ฎ",
VN: "๐ป๐ณ",
VU: "๐ป๐บ",
WF: "๐ผ๐ซ",
WS: "๐ผ๐ธ",
YE: "๐พ๐ช",
YT: "๐พ๐น",
ZA: "๐ฟ๐ฆ",
ZM: "๐ฟ๐ฒ",
ZW: "๐ฟ๐ผ"
}[c])) AS Q_FLAG
That is indeed a crazy query. Could you also show how it actually looks, or the top of a result from it?
Did you get that other post regarding how the subtraction of dates could be a little off when the days exceeded over a month? Shouldnโt matter a whole lot, but I just thought Iโd mention it.
I didnโt see that other post, but honestly the dates are just for estimates. Not doing science here haha
Combined with Cards, this is a sample of my gallery:
I just finished aliasing all authors and movie directors, so now all book/movie titles and all authors/directors are clickable.
Related to this, I tried doing the same aliasing to my two-letter country code, e.g. Country: US
to Country: "[[United States of America|US]]"
so I can also have a list by country page.
However, your awesome solution to my earlier problem from a few months ago, now no longer works, meaning I broke my query again:
FLATTEN join(map(split(Country, ", "), (c) => {
BZ: "๐ง๐ฟ",
CA: "๐จ๐ฆ",
US: "๐บ๐ธ"
}[c])) AS Q_FLAG
I canโt figure out how to implement this with the aliasing, since I now separate the Countries like this:
Country:
- "[[United States of America|US]]"
- "[[Canada|CA]]"
instead of like previously with a comma. The split
command no longer works, since thereโs no longer a split by commas, but removing the split thing doesnโt solve the problem.
Something like this also doesnโt work:
FLATTEN Country {
BZ: "๐ง๐ฟ",
CA: "๐จ๐ฆ",
US: "๐บ๐ธ"
} AS Q_FLAG
Can this be fixed? Thanks!
Topic
Summary
- How to to transform a country code into a flag icon via a JavaScript object?
Test
Summary
- dataview: v0.5.55
Input
Summary
dictionary files:
Summary
- Location: โ100_Project/02_dataview/Q25_MetaFunction/Q25_test_data02โ
folder: 03_a_string
- filename :
dic_19620306
---
Date: 1962-03-06
Country: "[[Canada|CA]]"
---
folder: 04_a_list
- filename :
dic_19800401
---
Date: 1962-04-06
Country:
- "[[United States of America|US]]"
---
folder: 05_a_list
- filename :
dic_19800501
---
Date: 1962-05-06
Country:
- "[[United States of America|US]]"
- "[[Canada|CA]]"
---
DQL11_transform_country_code_into_flag_icon_via_JavaScript_object_and_TABLE
Summary
Main DQL
Code Name | Data type | Group By | Purposes | Remark |
---|---|---|---|---|
DQL11 _transform_country_code _into_flag_icon _via_JavaScript_object _and_TABLE |
Country :1.a string like โ[[Canada|CA]]โ 2.an array of strings like [โ[[United States of America|US]]โ] |
no | 1.To filter by Country 2.To transform a country code into a flag icon via a JavaScript object 3.To sort by file.name in ascending order 4.To display the result as a table |
For Windows OS (To see Notes of the DQL10 _transform_country_code _into_flag_icon _from_HTML_Hex _and_TABLE): from Q20_Flags: S1 1.To require NotoColorEmojiLimited.css 2.To enable the CSS snippet |
Notes:
Summary
Q1: How to modify the following code?
Summary_Q1
Original Example: Q1 (To be modified and explained)
Original INPUT
- filename : O1
---
Country: "US"
---
- filename : O2
---
Country: "US, CA"
---
Original DQL
```dataview
TABLE WITHOUT ID
file.link AS "FILE",
Q_FLAG AS "Q_FLAG"
FROM "100_Project/02_dataview/Q25_MetaFunction/Q25_test_data02"
WHERE Country
// The input of map() method is an Array of Strings in the example.
// AoS is an abbreviation for an Array of Strings.
// O1: AoS = split(Country, ", ") = ["US"];
// O2: AoS = split(Country, ", ") = ["US", "CA"];
// c = an element of AoS;
// O1: c = "US";
// O2: c = "US", or "CA";
FLATTEN join(map(split(Country, ", "), (c) => {
BZ: "๐ง๐ฟ",
CA: "๐จ๐ฆ",
US: "๐บ๐ธ"
}[c])) AS Q_FLAG
```
A1_11:
Another Example: A1_11
New INPUT
- filename : N1
---
Country: "[[United States of America|US]]"
---
- filename : N2
---
Country:
- "[[United States of America|US]]"
- "[[Canada|CA]]"
---
New DQL
```dataview
TABLE WITHOUT ID
file.link AS "FILE",
Q_FLAG AS "Q_FLAG"
FROM "100_Project/02_dataview/Q25_MetaFunction/Q25_test_data02"
WHERE Country
// The input of map() method is an Array of Strings in the example.
// AoS is an abbreviation for an Array of Strings.
// N1: AoS = list(Country) = ["[[United States of America|US]]"];
// N2: AoS = Country = ["[[United States of America|US]]", "[[Canada|CA]]"];
// c = an element of AoS;
// N1: meta(c).display = "US";
// N2: meta(c).display = "US", or "CA";
FLATTEN join(map(choice(typeof(Country) = "array", Country, list(Country)), (c) => {
BZ: "๐ง๐ฟ",
CA: "๐จ๐ฆ",
US: "๐บ๐ธ"
}[meta(c).display])) AS Q_FLAG
```
Code DQL11_transform_country_code_into_flag_icon_via_JavaScript_object_and_TABLE
Summary_code
title: DQL11_transform_country_code_into_flag_icon_via_JavaScript_object_and_TABLE =>0.For Windows OS:To require `NotoColorEmojiLimited.css` and To enable the CSS snippet 1.To filter by `Country` 2.To transform a country code into a flag icon via a JavaScript object 3.To sort by `file.name` in ascending order 4.To display the result as a table
collapse: close
icon:
color:
```dataview
TABLE WITHOUT ID
file.link AS "FILE",
Q_FLAG AS "Q_FLAG"
FROM "100_Project/02_dataview/Q25_MetaFunction/Q25_test_data02"
WHERE Country
FLATTEN join(map(choice(typeof(Country) = "array", Country, list(Country)), (c) => {
BZ: "๐ง๐ฟ",
CA: "๐จ๐ฆ",
US: "๐บ๐ธ"
}[meta(c).display])) AS Q_FLAG
SORT file.name ASC
```
Screenshots(DQL10): NotoColorEmojiLimited.css
used on win7
Screenshots(DQL10): NotoColorEmojiLimited.css
not used on win7
Reference
Perfect, thank you!!!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.