Dataview: How do I use "contain" if there are two true options?

In my frontmatter there is a variable called Country: which is followed by the two letter code for that country, so e.g. Country: UK for the United Kingdom.
Now I’d like Dataview to replace this country code with a flag emoji in my Cards table, which I do with this rather unwieldy chain of choice combined with contain:

choice(contains(country, "US"), " 🇺🇸 ", 
choice(contains(country, "UK"), " 🇬🇧 ", 
choice(contains(country, "JP"), " 🇯🇵 ", 
choice(contains(country, "IN"), " 🇮🇳 ",
choice(contains(country, "CA"), " 🇨🇦 ",
choice(contains(country, "CL"), " 🇨🇱 ",
choice(contains(country, "IT"), " 🇮🇹 ",
choice(contains(country, "SI"), " 🇸🇮 ",
choice(contains(country, "AR"), " 🇦🇷 ",
choice(contains(country, "DE"), " 🇩🇪 ",
choice(contains(country, "AT"), " 🇦🇹 ",
choice(contains(country, "PL"), " 🇵🇱 ",
choice(contains(country, "MY"), " 🇲🇾 ",
choice(contains(country, "FR"), " 🇫🇷 ",
choice(contains(country, "CN"), " 🇨🇳 ",
choice(contains(country, "NG"), " 🇳🇬 ",
choice(contains(country, "KE"), " 🇰🇪 ",
choice(contains(country, "AU"), " 🇦🇺 ",
choice(contains(country, "BD"), " 🇧🇩 ",
choice(contains(country, "NZ"), " 🇳🇿 ",
choice(contains(country, "HK"), " 🇭🇰 ",
choice(contains(country, "SP"), " 🇪🇸 ", "")))))))))))))))))))))) as Flag

However, for some cases TWO countries apply, such as when a movie is made by people from different nations. How do I implement this? It would look like Country: US, UK. But since my chain of choice has US first, only the US flag shows up. How do I combine these so both flags would show up?

Thanks!

BTW if someone knows of a more elegant way of doing this, I’m all ears :slight_smile:

1 Like

The gist of a better solution is to first split your country code based on the comma, and then concatenate the result for each of the countries. And I would tend to use an array to lookup the icon instead of using choice, and then rather have a default in case they mess up the country code.

Such a solution could be done using various tools, but I leave that as an exercise for the reader. :smile:

Regards,
Holroy

I’m not sure I understand. That means you’d have it look up the flag online?

Not sure how to do that.

No, it means you use an array to hold all the icons and use the country code as the key to get your icon.

If that still doesn’t make any sense, you might consider taking a step back, and learn about arrays and lists, before proceeding. Sorry, if that feels a little hush, but you’ll be better off in the end if you know what you are coding, instead of being spoon fed.

Regards,
Holroy

OK, good point. I had a look at arrays, and now have something like this for testing:

``dataviewjs
const flags = [" 🇺🇸 ", " 🇬🇧 ", " 🇯🇵 ", " 🇮🇳 ", " 🇨🇦 ", " 🇨🇱 ", " 🇮🇹 ", " 🇸🇮 ",]
dv.paragraph(flags[0])

that flags[0] renders the US flag. However the issue I see with this solution is that I’m not sure Cards works with JS?

Edit: It seems Cards can use JS as well. But I can’t figure out how to render external images (links) which regular Dataview can handle fine.

Topic

Summary
  • How to transform a country code into a flag emoji?

Test

Summary
  • dataview: v0.5.46

Input

Summary

dictionary files:

Summary
  • Location: “100_Project/02_dataview/Q20_Flags/Q20_test_data”

folder: 03

  • filename : dic_19800301 (GB=United Kingdom)
---
Date: 1980-03-01
Country: "GB"
---




folder: 04

  • filename : dic_19800401 (US=United States)
---
Date: 1980-04-01
Country: "US"
---




folder: 05

  • filename : dic_19800501
---
Date: 1980-05-01
Country: ["US", "GB"]
---




PNG files:

  • all the worlds flags in PNG format : used by DQL20
Summary
  • Location: “999_Test/Q20_test_data02”

folder: png100px

  • filename : gb.png, us.png, and so on

Screenshots(PNG_preview)


DQL10_transform_country_code_into_flag_icon_from_HTML_Hex_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL10
_transform
_country_code
_into
_flag_icon
_from_HTML_Hex
_and_TABLE
Country:
1.a string
2.a list of strings
no 1.To filter by Country
2.To sort by file.link in ascending order
3.To display the result as a table
For Windows OS:

1.To require NotoColorEmojiLimited.css
2.To enable the CSS snippet

Notes

Summary

Q1: How do I view country flags on Windows 10 through HTML?

Summary_Q1

A1

Steps:
  • Suppose that your vault is note_a8.
  • Copy the following css file into the folder note_a8/.obsidian/snippets.
  • Settings/Appearances/CSS snippets: enable it.
Screenshots(DQL10_A1)
Summary_DQL10_A1

CSS file: using online NotoColorEmoji.ttf
Summary_CSS file
  • filename : NotoColorEmojiLimited.css
```CSS
/*
Problems: How do I view country flags on Windows 10 through HTML?
https://stackoverflow.com/questions/62729729/how-do-i-view-country-flags-on-windows-10-through-html
*/

/*
Solutions: answered Nov 18, 2021 at 14:48 By Felipe Saldanha

Use [Noto Color Emoji font](https://github.com/googlefonts/noto-emoji).

First, write a `@font-face` rule with the `unicode-range` property. Then add the font to the top of your font stack:
([Source](https://prinsfrank.nl/2021/01/25/Non-existing-flag-emojis-on-windows))
*/

@font-face {
  font-family: NotoColorEmojiLimited;
  unicode-range: U+1F1E6-1F1FF;
  src: url(https://raw.githack.com/googlefonts/noto-emoji/main/fonts/NotoColorEmoji.ttf);
}

div {
  font-family: 'NotoColorEmojiLimited', -apple-system, BlinkMacSystemFont, 
  'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 
  'Segoe UI Emoji', 'Segoe UI Symbol';
}



```

Code DQL10_transform_country_code_into_flag_icon_from_HTML_Hex_and_TABLE

Summary_code
title: DQL10_transform_country_code_into_flag_icon_from_HTML_Hex_and_TABLE =>0.For Windows OS:To require `NotoColorEmojiLimited.css` and To enable the CSS snippet 1.To filter by `Country` 2.To sort by `file.name` in ascending order 3.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID
      file.link AS "FILE",
      join(Country, " ") AS "Country",
      
      join(
          map(
              choice(typeof(Country) = "array", Country, list(Country)), 
                  (e) => 
                      {
                        "US": "🇺🇸",
                        "GB": "🇬🇧",
                        "JP": "🇯🇵",
                        "IN": "🇮🇳",
                        "CA": "🇨🇦",
                        "CL": "🇨🇱",
                        "IT": "🇮🇹",
                        "SI": "🇸🇮",
                        "AR": "🇦🇷",   
                        "DE": "🇩🇪",
                        "AT": "🇦🇹",
                        "PL": "🇵🇱",
                        "MY": "🇲🇾",
                        "FR": "🇫🇷",
                        "CN": "🇨🇳",
                        "NG": "🇳🇬",
                        "KE": "🇰🇪",
                        "AU": "🇦🇺",
                        "BD": "🇧🇩",
                        "NZ": "🇳🇿",
                        "HK": "🇭🇰",
                        "ES": "🇪🇸"
                      }[e]     
              )
           , " ")
          AS "Flag"

FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data"
WHERE Country
SORT file.name ASC

```

Screenshots(DQL10): NotoColorEmojiLimited.css used on win7(or win10)

Summary_A

)


Screenshots(DQL10): NotoColorEmojiLimited.css not used on win7(or win10)

Summary_B


DQL20_transform_country_code_into_flag_icon_from_PNG_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL20
_transform
_country_code
_into
_flag_icon
_from_PNG
_and_TABLE
Country:
1.a string
2.a list of strings
no 1.To filter by Country
2.To sort by file.name in ascending order
3.To display the result as a tableThe PNG
To require all the worlds flags in PNG format: download this repository

Notes

Summary

Q1: What is a country flag emoji?

from: SVG and PNG renders of all countries’ flags. >> Readme

Summary_Q1

A1

A country flag emoji is organized by an “ISO country-code”
  • The flags are named by their 2-letter ISO-3166 country code, except for the
    constituent countries of Great Britain which have 6-letter codes “GB-ENG” etc).

  • Kosovo uses the user-assigned country code XK, which is not part of the ISO standard, but in use by several multinational organizations.

  • Also included is a JSON file that maps the ISO country code to the name of the
    country.


Q2: How to get all country flag images?

from: SVG and PNG renders of all countries’ flags. >> Readme

Summary_Q2

A2


Code DQL20_transform_country_code_into_flag_icon_from_PNG_and_TABLE

Summary_code
title: DQL20_transform_country_code_into_flag_icon_from_PNG_and_TABLE =>0.To require all the worlds flags in PNG format: [download this repository](https://github.com/hampusborgos/country-flags/archive/refs/heads/main.zip) 1.To filter by `Country` 2.To sort by `file.link` in ascending order 3.To display the result as a table
collapse: close
icon: 
color: 
```dataview
TABLE WITHOUT ID
      file.link AS "FILE",
      Country AS "Country",     

      map(
          choice(typeof(Country) = "array", Country, list(Country)), 
              (e) => 
                  embed(link("999_Test/Q20_test_data02/png100px/" + lower(e) + ".png"))                  
          )
      AS "Flag"

FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data"
WHERE Country

SORT file.name ASC

```

Screenshots(DQL20)


Reference

Summary

used by DQL10 or DQL20

used by DQL10

Emoji Flags

  • The following order is the same as that of ReaderGuy42’s nested choice statement.
Summary_Flags

used by DQL20


Hey justdoit:
Can you dumb this response down for a simpler request ? What if I want to tag status of a project with a “Done” field (responses could be ‘not started’, ‘almost done’ and ‘done’. Each would be represented by a red, yellow and green circle.

I know how to use choice() for a true/false. For example:

table WITHOUT ID
file.link AS “Document”,
choice(Done, “:green_circle:”, “:yellow_circle:”) AS “Status”
FROM “020 Investments/Pages”
WHERE Done != null

Is there an easy way to choose from 3 items with choice ? Thanks so much !

You can present the third option as the “else”. With the help of someone, my dataview thing looks like this now:


TABLE without id 
("![](" + Cover + ")") as Cover,
link(file.link, Alias) + " by " + Author + (choice(medium = "Book", " 📖 ", choice(medium = "Audiobook", " 🎧 ", choice(medium = "Podcast", " 📻 ", choice(medium = "eBook", " 📃 ", ""))))) + choice(contains(tags, "Favorite"), "💛", "") as Title, 
Year + " || " + " ⭐ " + Rating + " || " + (choice(medium = "Book", Pages + " p", choice(medium = "Audiobook", Hours + " h", choice(medium = "Podcast", Hours + " h", choice(medium = "eBook", Pages + " p", ""))))) + " || " + map(split(Country, ", "), (c) => ((x) => {
AD: "🇦🇩",
AE: "🇦🇪",
AF: "🇦🇫",
AG: "🇦🇬",
AI: "🇦🇮",
AL: "🇦🇱",
AM: "🇦🇲",
AO: "🇦🇴",
AQ: "🇦🇶",
AR: "🇦🇷",
[...]
WS: "🇼🇸",
YE: "🇾🇪",
YT: "🇾🇹",
ZA: "🇿🇦",
ZM: "🇿🇲",
ZW: "🇿🇼"
}[x])(c)) as "Time and Place",
DateStarted + " — " + DateFinished as Dates,
"(" + choice((DateFinished != DateStarted), (DateFinished - DateStarted).days + " days", "0 days" ) + ")" as "Reading Time"
FROM "Book Log/2022"
WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"
SORT DateFinished desc

So you could do

choice(status = "not started", "🔴", choice(status = "almost done",  “🟡”, choice(status = "done",  “🟢”, ""))) as "Status"

by nesting the choice function you can get more than two outcomes. If you just want three options it’s pretty straight forward (I think). In this example, after the “:green_circle:” you can’t forget the extra ,"" as that’s the last else function. You could also put a “:question:” in there, for example, because then if there’s a note with an empty status field, or one that isn’t one of those three options it should output a “:question:” to signify that.

Let me know if this works out for you :slight_smile:

Let’s say your field key is status, instead of Done.
In regular DQL queries, instead of nested choice(), as suggested by @ReaderGuy42, you can use something like this:

TABLE ((x) => {"done": "🟢", "almost done": "🟡", "not started": "⚠️"}[x])(status) AS Status
FROM "020 Investments/Pages"
WHERE status

or

TABLE Status
FROM "020 Investments/Pages"
WHERE status
FLATTEN ((x) => {"done": "🟢", "almost done": "🟡", "not started": "⚠️"}[x])(status) AS Status

This is something related with “IIFE = immediately invoked function expression” (don’t ask me, I’m not a coder)

3 Likes

Both work perfectly. Once again, mnvwvnm, you save the day. 'brigado !!!

1 Like

Topic

Summary
  • How to transform a Done field content which is ‘not started’, ‘almost done’ or ‘done’ into a red, yellow or green circle icon?

Test

Summary
  • dataview: v0.5.46

Input

Summary

dictionary files:

  • Location: “100_Project/02_dataview/Q20_Flags/Q20_test_data03”

folder: 03

  • filename : dic_19800306
---
Date: 1980-03-06
Done: "done"
---



folder: 04

  • filename : dic_19800406
---
Date: 1980-04-06
Done: "almost done"
---



folder: 05

  • filename : dic_19800506
---
Date: 1980-05-06
Done: "not started"
---



DQL10: Use {key1:value1, …}[Done]

Summary

Code DQL10

Summary_code
title: DQL10 => Use {key1:value1, ...}[Done]
collapse: close
icon: 
color:
```dataview
TABLE WITHOUT ID
      file.link AS "Document",
      Status AS "Status"

FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data03"
WHERE Done != null

FLATTEN {
    "not started": "🔴",
    "almost done": "🟡",
    "done": "🟢"
}[Done] AS Status
```

Screenshots(DQL10)


DQL11: Use object(key1, value1, …)[Done]

Summary

Code DQL11

Summary_code
title: DQL11 => Use object(key1, value1, ...)[Done]
collapse: close
icon: 
color:
```dataview
TABLE WITHOUT ID
      file.link AS "Document",
      Status AS "Status"

FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data03"
WHERE Done != null

FLATTEN object(
    "not started", "🔴",
    "almost done", "🟡",
    "done", "🟢"
)[Done] AS Status
```

Screenshots(DQL11)


Reference

Summary

Emoji

Q01_Sum

Q19_Workout


1 Like

Fantastic - thank you !

1 Like

I can’t get this to work for me. When I try implementing your FLATTEN, I get Parsing errors:


TABLE without id 
("![](" + Cover + ")") as Cover,
link(file.link, Alias) + " by " + Author,
Medium as "Medium"
Where Status != null

FLATTEN object(
    "Book", " 📖 ",
    "Audiobook", " 🎧 ",
    "Podcast", " 📻 ",
    "eBook", " 📃 "
)[Medium] AS Medium,
 choice(contains(tags, "Favorite"), "💛", "") as Title, 
Year + " || " + " ⭐ " + Rating + " || " + (choice(medium = "Book", Pages + " p", choice(medium = "Audiobook", Hours + " h", choice(medium = "Podcast", Hours + " h", choice(medium = "eBook", Pages + " p", ""))))) + " || " + map(split(Country, ", "), (c) => ((x) => {
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: "🇿🇼"
}[x])(c)) as "Time and Place",
DateStarted + " — " + DateFinished as Dates,
"(" + choice((DateFinished != DateStarted), (DateFinished - DateStarted).days + " days", "0 days" ) + ")" as "Reading Time"
FROM "Book Log/2022"
WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"
SORT DateFinished desc

For reference, my version with the nested choice doesn’t look nice, but worked:

TABLE without id 
("![](" + Cover + ")") as Cover,
link(file.link, Alias) + " by " + Author + (choice(medium = "Book", " 📖 ", choice(medium = "Audiobook", " 🎧 ", choice(medium = "Podcast", " 📻 ", choice(medium = "eBook", " 📃 ", ""))))) + choice(contains(tags, "Favorite"), "💛", "") as Title, 
Year + " || " + " ⭐ " + Rating + " || " + (choice(medium = "Book", Pages + " p", choice(medium = "Audiobook", Hours + " h", choice(medium = "Podcast", Hours + " h", choice(medium = "eBook", Pages + " p", ""))))) + " || " + map(split(Country, ", "), (c) => ((x) => {
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: "🇿🇼"
}[x])(c)) as "Time and Place",
DateStarted + " — " + DateFinished as Dates,
"(" + choice((DateFinished != DateStarted), (DateFinished - DateStarted).days + " days", "0 days" ) + ")" as "Reading Time"
FROM "Book Log/2022"
WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"
SORT DateFinished desc

but I’d like to try your FLATTEN because it’s easier to add more values.
Any ideas?
Thanks :slight_smile:

Idea A

  • The WHERE(or FLATTEN) statement should be behind the FROM statement.
  • The FLATTEN statement ends with a field variable like AS Medium instead of AS Medium,.
Summary

DQL01_bug_ReaderGuy42: errors

I can’t get this to work for me. When I try implementing your FLATTEN, I get Parsing errors

```dataview
TABLE without id 
      ("![](" + Cover + ")") AS Cover,
      link(file.link, Alias) + " by " + Author,
      Medium AS "Medium"

WHERE Status != null

FLATTEN object(
    "Book", " 📖 ",
    "Audiobook", " 🎧 ",
    "Podcast", " 📻 ",
    "eBook", " 📃 "
)[Medium] AS Medium,

FROM "Book Log/2022"
WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"
SORT DateFinished desc
```

DQL02_bug_fixed_ReaderGuy42: OK

```dataview
TABLE without id 
      ("![](" + Cover + ")") AS Cover,
      link(file.link, Alias) + " by " + Author,
      Medium AS "Medium"

FROM "Book Log/2022"

WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"
WHERE Status != null

SORT DateFinished desc

FLATTEN object(
    "Book", " 📖 ",
    "Audiobook", " 🎧 ",
    "Podcast", " 📻 ",
    "eBook", " 📃 "
)[Medium] AS Medium


```

Idea B

  • The FLATTEN operator, which is different from the TABLE operator, does not support batch processing different statements.
  • You need at least five FLATTEN statements to do it because there are to be five new variables like MediumIcon, Title, TimeAndPlace, Dates and ReadingTime.
Summary

DQL03_bug_ReaderGuy42: errors

I can’t get this to work for me. When I try implementing your FLATTEN, I get Parsing errors

```dataview
FLATTEN object(
    "Book", " 📖 ",
    "Audiobook", " 🎧 ",
    "Podcast", " 📻 ",
    "eBook", " 📃 "
)[Medium] AS Medium,
 choice(contains(tags, "Favorite"), "💛", "") as Title, 
Year + " || " + " ⭐ " + Rating + " || " + (choice(medium = "Book", Pages + " p", choice(medium = "Audiobook", Hours + " h", choice(medium = "Podcast", Hours + " h", choice(medium = "eBook", Pages + " p", ""))))) + " || " + map(split(Country, ", "), (c) => ((x) => {
AD: "🇦🇩",
AE: "🇦🇪",
...
...
ZW: "🇿🇼"
}[x])(c)) as "Time and Place",
DateStarted + " — " + DateFinished as Dates,
"(" + choice((DateFinished != DateStarted), (DateFinished - DateStarted).days + " days", "0 days" ) + ")" as "Reading Time"

```

Idea C

  • When you’re going to write a FLATTEN statement, it is recommended that defining a new field variable is better than using the original variable for easier reading.
Summary

To use an original variable like Medium

```dataview
FLATTEN object(
    "Book", " 📖 ",
    "Audiobook", " 🎧 ",
    "Podcast", " 📻 ",
    "eBook", " 📃 "
)[Medium] AS Medium
```

To define a new field variable like MediumIcon

```dataview
FLATTEN object(
    "Book", " 📖 ",
    "Audiobook", " 🎧 ",
    "Podcast", " 📻 ",
    "eBook", " 📃 "
)[Medium] AS MediumIcon
```

The DQL30 does what your original DQL that contains 252 country codes does.
What you have to do is to modify the FROM statement.

Topic

Summary
  • How to transform a country code into a flag emoji via JavaScript Objects?
  • How to simplify nested choices where a Medium field content is “Book”, “Audiobook”, “Podcast” or “eBook”?

Test

Summary
  • dataview: v0.5.46

Input

Summary

dictionary files:

Summary
  • Location: “100_Project/02_dataview/Q20_Flags/Q20_test_data04”

folder: 03

  • filename : dic_19800311 (US=United States) (GB=United Kingdom)
---
Date: 1980-03-11
tags: [Favorite]
Alias: "Javascript: The Definitive Guide, 7/e"
Medium: "Book"
Author: "David Flanagan"
 
Country: "US, GB"
DateStarted: "2020-06-23"
DateFinished: "2020-07-25"
Status: "done"

Year: 2020
Rating: 5
Pages: 680
Hours: 
Cover: https://m.media-amazon.com/images/W/WEBP\_402378-T2/images/I/919ZMTHDPBL.\_AC\_SX75\_CR,0,0,75,75\_.jpg
---



# Javascript: The Definitive Guide, 7/e
- What :: [Javascript: The Definitive Guide, 7/e](https://www.amazon.com/-/es/David-Flanagan/dp/1491952024/ref=sr_1_1?__mk_es_US=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=32QHTGRP393RS&keywords=Javascript&qid=1672211738&s=books&sprefix=javascript%2Cstripbooks-intl-ship%2C286&sr=1-1)
- Authors :: 
- Keywords :: 
- Summaries :: 
- Comments :: 
- Downloaded :: 



folder: 04

  • filename : dic_19800411 (IT=Italy)
---
Date: 1980-04-11
tags: [Favorite]
Alias: "UNIX Shells by Example, 4/e"
Medium: "Audiobook"
Author: "Ellie Quigley"

Country: "IT"
DateStarted: "2004-09-01"
DateFinished: "2005-12-25"
Status: "done"

Year: 2004
Rating: 4
Pages: 
Hours: 1200
Cover: https://m.media-amazon.com/images/W/WEBP\_402378-T2/images/I/91vUmLEjbHL.\_AC\_SX75\_CR,0,0,75,75\_.jpg
---


# UNIX Shells by Example, 4/e
- What :: [UNIX Shells by Example, 4/e](https://www.amazon.com/-/es/Ellie-Quigley/dp/013147572X/ref=sr_1_1?__mk_es_US=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=IHF5F5CXXTV0&keywords=UNIX+Shells+by+Example&qid=1672214391&s=books&sprefix=unix+shells+by+example%2Cstripbooks-intl-ship%2C250&sr=1-1)
- Authors :: 
- Keywords :: 
- Summaries :: 
- Comments :: 
- Downloaded :: 




folder: 05

  • filename : dic_19800511 (DE=Germany)
---
Date: 1980-05-11
tags: [Favorite]
Alias: "P_Podcast"
Medium: "Podcast"
Author: "YYY"

Country: "DE"
DateStarted: "2022-12-16"
DateFinished: "2022-12-17"
Status: "done"

Year: 2000
Rating: 3
Pages: 
Hours: 8
Cover: https://media.wnyc.org/i/200/200/c/70/2022/12/NullandVoid_1600x1200.png
---



# Null and Void
- What :: [Null and Void](https://radiolab.org/episodes/null-and-void-2212)
- Authors :: 
- Keywords :: 
- Summaries :: 
- Comments :: 
- Downloaded :: 



folder: 06

  • filename : dic_19800611 (FR=France)
---
Date: 1980-06-11
tags: [Favorite]
Alias: "Perl by Example, 5/e"
Medium: "eBook"
Author: "Ellie Quigley"

Country: "FR"
DateStarted: "2014-12-17"
DateFinished: "2015-12-21"
Status: "done"

Year: 2014
Rating: 5
Pages: 888
Hours: 
Cover: https://m.media-amazon.com/images/W/WEBP\_402378-T2/images/I/41aGGHu7Q-L.\_AC\_SX75\_CR,0,0,75,75\_.jpg
---



# Perl by Example, 5/e
- What :: [Perl by Example, 5/e](https://www.amazon.com/-/es/Ellie-Quigley/dp/0133760812/ref=sr_1_1?__mk_es_US=%C3%85M%C3%85%C5%BD%C3%95%C3%91&crid=207AKU6YA3671&keywords=perl+by+example&qid=1672212277&s=books&sprefix=perl+by+exampl%2Cstripbooks-intl-ship%2C432&sr=1-1)
- Authors :: 
- Keywords :: 
- Summaries :: 
- Comments :: 
- Downloaded :: 




folder: 08_excluded

  • filename : dic_19800811 (US=United States)
---
Date: 1980-08-11
tags: [test]
Alias: "Z_Others"
Medium: "Others"
Author: "XXX"

Country: "US"
DateStarted: 
DateFinished: 
Status: "done"

Year: 2020
Rating: 1
Pages: 100
Hours:
Cover:
---



# Z_Others
- What :: 
- Authors :: 
- Keywords :: 
- Summaries :: 
- Comments :: 
- Downloaded :: 




DQL30_simplify_nested_choices_via_JavaScript_Objects_and_TABLE

Summary

Main DQL

Code Name Data type Group By Purposes Remark
DQL30
_simplify_nested_choices
_via_JavaScript_Objects
_and_TABLE
Country:
1.a string like “FR”
2.a tring like “US, GB”

Medium:
1.“Book”
2.“Audiobook”
3.“Podcast”
4.“eBook”
no 1.To simplify ReaderGuy42’s original DQL that contains 252 country codes
2.For best performance
3.For easier reading
4.For easier modification
5.For easier debugging
For Windows OS
(To see Notes of the DQL10
_transform_country_code
_into_flag_icon
_from_HTML_Hex
_and_TABLE):

1.To require NotoColorEmojiLimited.css
2.To enable the CSS snippet

Notes

Summary

Q1: How to modify the following code when “typeA”, “typeB” or “Others” (icons: a red , yellow or green circle)(units: h, p, p) is added to a Medium field content?

Summary_Q1
Original Example: Q1 (To be modified)
```dataview


WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"


FLATTEN {
    "Book": " 📖 ",
    "Audiobook": " 🎧 ",
    "Podcast": " 📻 ",
    "eBook": " 📃 "
}[Medium] AS P_MediumIcon


FLATTEN {
    "Book": Pages + " p",
    "Audiobook": Hours + " h",
    "Podcast": Hours + " h",
    "eBook": Pages + " p"
}[Medium] AS Q_PagesHours


```

A1:

Another Example: A1_11
```dataview


WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook" OR Medium = "typeA" OR Medium = "typeB" OR Medium = "Others"


FLATTEN {
    "Book": " 📖 ",
    "Audiobook": " 🎧 ",
    "Podcast": " 📻 ",
    "eBook": " 📃 ",
    "typeA": " 🔴 ",
    "typeB": " 🟡 ",
    "Others": " 🟢 "
}[Medium] AS P_MediumIcon


FLATTEN {
    "Book": Pages + " p",
    "Audiobook": Hours + " h",
    "Podcast": Hours + " h",
    "eBook": Pages + " p",
    "typeA": Pages + " h",
    "typeB": Pages + " p",
    "Others": Pages + " p"
}[Medium] AS Q_PagesHours


```

Code DQL30_simplify_nested_choices_via_JavaScript_Objects_and_TABLE

Summary_code
title: DQL30_simplify_nested_choices_via_JavaScript_Objects_and_TABLE =>0.For Windows OS:To require `NotoColorEmojiLimited.css` and To enable the CSS snippet 1.To simplify ReaderGuy42's original DQL 2.For best performance 3.For easier reading 4.For easier modification 5.For easier debugging
collapse: close
icon: 
color: 
```dataview
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 AS "Reading Time"
      
FROM "100_Project/02_dataview/Q20_Flags/Q20_test_data04"

WHERE Status != null
WHERE Medium = "Book" OR Medium = "Audiobook" OR Medium = "Podcast" OR Medium = "eBook"
SORT DateFinished desc


FLATTEN link(file.link, Alias) + " by " + Author AS P_BookByAuthor
FLATTEN choice(contains(tags, "Favorite"), "💛", "") AS P_FavoriteIcon

FLATTEN {
    "Book": " 📖 ",
    "Audiobook": " 🎧 ",
    "Podcast": " 📻 ",
    "eBook": " 📃 "
}[Medium] AS P_MediumIcon



FLATTEN DateStarted + " — " + DateFinished AS R_Dates
FLATTEN "(" + choice((DateFinished != DateStarted), (DateFinished - DateStarted).days + " days", "0 days" ) + ")" AS S_ReadingTime



FLATTEN Year + " || " + " ⭐ " + Rating + " || " AS Q_YearRating

FLATTEN {
    "Book": Pages + " p",
    "Audiobook": Hours + " h",
    "Podcast": Hours + " h",
    "eBook": Pages + " p"
}[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

```

Screenshots(DQL30): NotoColorEmojiLimited.css used on win7

Summary_A


Screenshots(DQL30): NotoColorEmojiLimited.css not used on win7

Summary_B


Related resources

Summary

Emojis

JavaScript Objects

The exercises of using FLATTEN


1 Like

Thank you that’s perfect! Just took me a while to figure it all out. This is awesome, I really appreciate it! Now it’s much easier to add new types of media, etc. :slight_smile:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.