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:
<SPAN class="operator token"><</SPAN>script script type<SPAN class="operator token">=</SPAN><SPAN class="string token">"text/plain"</SPAN> id<SPAN class="operator token">=</SPAN><SPAN class="string token">"featureLabel"</SPAN><SPAN class="operator token">></SPAN>
<SPAN class="keyword token">var</SPAN> siteName <SPAN class="operator token">=</SPAN> <SPAN class="string token">"$feature.SiteName"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> commonName <SPAN class="operator token">=</SPAN> <SPAN class="string token">"$feature.Common_Name"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> label <SPAN class="operator token">=</SPAN> <SPAN class="token function">When</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="token function">IsEmpty</SPAN><SPAN class="punctuation token">(</SPAN>commonName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">,</SPAN>siteName<SPAN class="punctuation token">,</SPAN>commonName<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> label<SPAN class="punctuation token">;</SPAN>
<SPAN class="operator token"><</SPAN><SPAN class="operator token">/</SPAN>script<SPAN class="operator token">></SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>I want to assign the return value of this script to a variable. I tried to create a label class based on this example:
<SPAN class="keyword token">var</SPAN> labelArcade <SPAN class="operator token">=</SPAN> document<SPAN class="punctuation token">.</SPAN><SPAN class="token function">getElementById</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="string token">"featureLabel"</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN>text<SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> label <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">LabelClass</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
labelExpressionInfo<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">{</SPAN>
expression<SPAN class="punctuation token">:</SPAN> labelArcade
<SPAN class="punctuation token">}</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>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.