Ik probeer een Arcade-uitdrukking te gebruiken om gecodeerde waarden weer te geven in een popup in ArcGIS Online, maar het werkt niet. Ik gebruik de code van het decode voorbeeld<\/A>. Het wordt niet weergegeven in de popup. Er wordt geen foutmelding gegeven in de popup.<\/P><\/P>var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P><\/P>Ik ben niet de auteur van de kaartservice. Het dn-veld is een esriFieldTypeDouble.<\/EM> Dank u.<\/P><\/P><\/EM><\/P><\/BODY><\/HTML>
<\/P>
var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P>
Ik ben niet de auteur van de kaartservice. Het dn-veld is een esriFieldTypeDouble.<\/EM> Dank u.<\/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?
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.