Hey folks, am I missing something within this new map viewer? Super frustrating to work with Arcade Expressions. I am using the following document without any success Introducing Arcade pop-up content elements . When referencing a variable the format described in the document does not work. For example, using the Rich Text Template:
var cpoName = IIF(IsEmpty(Trim($feature.CPONAME})),"","CPO Name: ");
return {
"type" : "text",
"text" : '${cpoName}' //this property supports html tags
}
However, when I remove the quotes - all is good. Am I missing something or is the documentation that bad? I understand it's a big transition from Classic to the New Viewer but the functionality should be the same. Anyway, has anyone else experienced this.
Jim L.
Solved! Go to Solution.
It looks like you're not using the correct symbol in the text property. Instead of using a quote ('), use the backtick(`). See this blog for information about string template literals: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/manage-your-strings-quite-literally-...
It looks like you're not using the correct symbol in the text property. Instead of using a quote ('), use the backtick(`). See this blog for information about string template literals: https://www.esri.com/arcgis-blog/products/arcgis-online/mapping/manage-your-strings-quite-literally-...
Thank you for the helpful tip. Kind of goes against most coding/scripting techniques, no? I don't ever remembering using backticks. A bit weird but at least it works. Thanks
The template literal was introduced in JavaScript with the ES6 revision and is used quite commonly in that.
Exclusive to JavaScript and Arcade. Got ya. Thank for the tip.