J'essaie d'utiliser une expression Arcade pour afficher des valeurs codées dans une fenêtre contextuelle dans ArcGIS Online, mais cela ne fonctionne pas. J'utilise le code de l'exemple de decode example<\/A>. Il ne s'affiche pas dans la fenêtre contextuelle. Aucun message d'erreur n'est donné dans la fenêtre contextuelle.<\/P><\/P>var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P><\/P>Je ne suis pas l'auteur du service de carte. Le champ dn est un esriFieldTypeDouble.<\/EM> Merci.<\/P><\/P><\/EM><\/P><\/BODY><\/HTML>
<\/P>
var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P>
Je ne suis pas l'auteur du service de carte. Le champ dn est un esriFieldTypeDouble.<\/EM> Merci.<\/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?
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.