How do I use "contain" if there are two true options? #1565
-
In my frontmatter there is a variable called
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 Thanks! BTW if someone knows of a more elegant way of doing this, I'm all ears :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I can suggest this, but isn't easy to understand it (don't ask me to explain this "IIFE = immediately invoked function expression"..., I'm not a coder or similar, just a curious): TABLE split(Country, ", ") AS Country, map(split(Country, ", "), (c) => ((x) => {US: "🇺🇸", UK: "🇬🇧", FR: "🇫🇷", PT: "🇵🇹"}[x])(c)) AS Flag
WHERE Country
SORT file.name ASC
|
Beta Was this translation helpful? Give feedback.
I can suggest this, but isn't easy to understand it (don't ask me to explain this "IIFE = immediately invoked function expression"..., I'm not a coder or similar, just a curious):
Country: US, UK
isn't the right syntax to a list of values.US, UK
is just a string with a comma. That's why you need to use thesplit()
function, with the advantage that the results of this operation are arrays (even if only one value).((x) => { A: 1, B: 2 }[x])(Field)
, well, don't ask me :) - link