I have an app based on this JS template for hovering over features. I want the title of the dialog to come from an Arcade expression. I set up a plain text script:
<script script type="text/plain" id="featureLabel">
var siteName = "$feature.SiteName";
var commonName = "$feature.Common_Name";
var label = When(IsEmpty(commonName),siteName,commonName);
return label;
</script>
I want to assign the return value of this script to a variable. I tried to create a label class based on this example:
var labelArcade = document.getElementById("featureLabel").text;
var label = new LabelClass({
labelExpressionInfo: {
expression: labelArcade
}
});
but var label just prints out [object Object]. Is there a way to just get the return value and assign that to a variable? I know how to do this in Python, but I'm going in circles on this one.