Ich versuche, einen Arcade-Ausdruck zu verwenden, um codierte Werte in einem Popup in ArcGIS Online anzuzeigen, aber es funktioniert nicht. Ich verwende den Code aus dem decode Beispiel<\/A>. Es wird im Popup nicht angezeigt. Im Popup wird keine Fehlermeldung angezeigt.<\/P><\/P>var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P><\/P>Ich bin nicht der Autor des Kartendienstes. Das dn-Feld ist ein esriFieldTypeDouble.<\/EM> Vielen Dank.<\/P><\/P><\/EM><\/P><\/BODY><\/HTML>
<\/P>
var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P>
Ich bin nicht der Autor des Kartendienstes. Das dn-Feld ist ein esriFieldTypeDouble.<\/EM> Vielen Dank.<\/P><\/P><\/EM><\/P><\/BODY><\/HTML>
You needed to state what value to return. See the documentation about this.
<SPAN class="keyword token">var</SPAN> code <SPAN class="operator token">=</SPAN> $feature<SPAN class="punctuation token">.</SPAN>dn<SPAN class="punctuation token">;</SPAN> <SPAN class="keyword token">var</SPAN> decodedValue <SPAN class="operator token">=</SPAN> <SPAN class="token function">Decode</SPAN><SPAN class="punctuation token">(</SPAN>code<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Non-Severe'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">3</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Marginal'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">4</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Slight'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Other'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> decodedValue<SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">//return decodedValue; also works</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>
or it could be a single line expression.
<SPAN class="token function">Decode</SPAN><SPAN class="punctuation token">(</SPAN>$feature<SPAN class="punctuation token">.</SPAN>dn<SPAN class="punctuation token">,</SPAN> <SPAN class="number token">2</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Non-Severe'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">3</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Marginal'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="number token">4</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Slight'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'Other'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN> <SPAN class="comment token">// return Decode($feature.dn, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other'); to be more explicit</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>
Great! Thanks, that worked.
Sure it is a public service from NWS: Layer: Day 1 Convective Outlook (ID: 1)
Possible values are 2, 3, 4, 5, 6, and 7.
What are the values that are possible for dn? Can you share that service or provide a list of some of the values?
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.