isCountry
Tests if a name is recognized by the countryAdjective and countryDeterminer functions.
The function returns a Boolean value of true or false.
Both countryAdjective
and countryDeterminer
return a minor warning when they don't recognize the input country name. If required, you can use isCountry
in a conditional to avoid generating the warning.
Parameters
COUNTRY (string)
The name to check.
Notes
The input string is not recognized unless it appears on Studio's in-built list of countries.
The input string is not recognized when it already includes a 'the' determiner.
Examples
ATL in Script | Result | Notes |
---|---|---|
| true | France is a recognized country name. |
| true | Germany is a recognized country name. |
| false | Absurdistan (fictional country) is not recognized. |
| true | Netherlands is a recognized country name |
| false | The Netherlands (with 'the' determiner) is not recogized. |
Using isCountry in a conditional statement
Assume a "Describe Each Row" project with this data:
ID | Name | Country | Rating | |
---|---|---|---|---|
Row 1 | 1001 | Magnus Carlsen | Norway | 2864 |
Row 2 | 1002 | Rufus T. Firefly | Freedonia | -2900 |
Also, assume a script with this content:
[[Name]] is a [[countryAdjective(Country)]] chess player. |
The script uses countryAdjective to convert the Country value to its adjective form. The Row 1 output is:
Narrative Text | Minor Warning |
---|---|
Magnus Carlsen is a Norwegian chess player. | N/A |
When countryAdjective
does NOT recognize the input country name, it returns the input name unchanged. In addition, it returns a minor warning message. Therefore, the Row 2 output is:
Narrative Text | Minor Warning |
---|---|
Rufus T. Firefly is a Freedonia chess player. | 'Freedonia' is not recognized as a country name. |
To avoid generating the warning, use isCountry
with countryAdjective
in a conditional statement:
[[Name]] is a [[isCountry(Country) ? "[[countryAdjective(Country)]] chess player" : "chess player from [[Country]]"]]. |
Tip
The conditional statement is written in ternary syntax. See Syntax for conditionals.
The conditional changes the Row 2 output to:
Narrative Text | Minor Warning |
---|---|
Rufus T. Firefly is a chess player from Freedonia. | N/A |
The conditional removes the warning AND returns a less clunky sentence. The Row 1 output is unchanged:
Narrative Text | Minor Warning |
---|---|
Magnus Carlsen is a Norwegian chess player. | N/A |