Estoy intentando usar una expresión Arcade para mostrar valores codificados en un popup en ArcGIS Online, pero no funciona. Estoy usando el código del ejemplo de decode<\/A>. No se muestra en el popup. No aparece ningún mensaje de error en el popup.<\/P><\/P>var code = $feature.dn;var decodedValue = Decode(code, 2, 'No Severo', 3, 'Marginal', 4, 'Leve', 'Otro');<\/P><\/P>No soy el autor del servicio de mapas. El campo dn es un esriFieldTypeDouble.<\/EM> Gracias.<\/P><\/P><\/EM><\/P><\/BODY><\/HTML>
<\/P>
var code = $feature.dn;var decodedValue = Decode(code, 2, 'No Severo', 3, 'Marginal', 4, 'Leve', 'Otro');<\/P>
No soy el autor del servicio de mapas. El campo dn es un esriFieldTypeDouble.<\/EM> Gracias.<\/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?
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.