Snažím se použít výraz Arcade k zobrazení kódovaných hodnot v popup okně v ArcGIS Online, ale nefunguje to. Používám kód z příkladu decode<\/A>. Vyskakovací okno nic nezobrazuje. V popup okně není zobrazena žádná chybová zpráva.<\/P><\/P>var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P><\/P>Nejsem autorem mapové služby. Pole dn je esriFieldTypeDouble.<\/EM> Děkuji.<\/P><\/P><\/EM><\/P><\/BODY><\/HTML>
<\/P>
var code = $feature.dn;var decodedValue = Decode(code, 2, 'Non-Severe', 3, 'Marginal', 4, 'Slight', 'Other');<\/P>
Nejsem autorem mapové služby. Pole dn je esriFieldTypeDouble.<\/EM> Děkuji.<\/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?
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.