Hi Everyone,
I am new to using ArcGIS Pro and Arcade, I wanted to have a few calculated fields in my table, not sure what's going wrong. I wanted the user to choose a value for the CommonName field and the app would fill out the ScientificName field. So I tried using the Arcade syntax, this was what I came up with:
var commonName = $feature.CommonName;
var scientificName = "";
if (commonName == "Yellow Floating Heart") {
scientificName = "Nymphoides peltate";
} else if (commonName == "Japanese Knotweed") {
scientificName = "Reynoutria japonica";
} else if (commonName == "Invasive Phragmites") {
scientificName = "Phragmites australis";
} else if (commonName == "Himalayan knotweed") {
scientificName = "Koenigia polystachya";
} else if (commonName == "Giant knotweed") {
scientificName = "Reynoutria sachalinensis";
} else if (commonName == "Fanwort") {
scientificName = "Cabomba caroliniana";
} else if (commonName == "European frogbit") {
scientificName = "Hydrocharis morsus-ranae";
} else if (commonName == "Dog-Strangling Vine") {
scientificName = "Vincetoxicum rossicum";
} else if (commonName == "Bohemian knotweed") {
scientificName = "Reynoutria ×bohemica";
} else if (commonName == "Black dog-strangling vine") {
scientificName = "Vincetoxicum nigrum";
return scientificName;
} else {
// Default value if no match is found
scientificName = "What";
}
return scientificName;
I know the script is reading the correct value for the CommonName because if I set the scientifiName to CommonName the value is filled in the field. However, my script is returning "What", do you know where I might have gone wrong with this?
Regards,
Aleem
