I have a field called "OfficialQH" that holds either a 0 or a 1. I want to display those values as "No", or "Yes", respectively. I'm a javascript novice and I have a feeling I'm missing something silly, but this is what I've got. I have been following along with these examples:
PopupTemplate - use functions to set content | ArcGIS API for JavaScript 4.6
Format info window content | ArcGIS API for JavaScript 3.23
I'm not sure I'm using "value" in my switch statement correctly. I understand that the key is the field name, the value is what is associated with the key in that record, and the data allows you to access other attributes of that record (I think?). So when {OfficialQH:status} gets hit because a feature was clicked, I expect it to call the status function, pass in key = OfficialQH, value = 1 (or 0 depending on the feature clicked), data = other available attributes of record. Then in the switch statement, it reads the value and assigns the result variable a "Yes" or "No" string, then returns the result to hopefully display in the popup. Is my logic flawed? Am I missing a pesky parentheses or bracket? Is there another way I should be using value/key/data?
<SPAN class="keyword token">var</SPAN> popup <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">{</SPAN>
title<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"{StateID}, Point {Point}, Patch {PatchNum}"</SPAN><SPAN class="punctuation token">,</SPAN>
content<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"<ul><li>Canopy Deciduous: {CnpyDecid}%</li>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<li>Canopy Coniferous: {CnpyConif}%</li>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<li>Bare Ground: {BareGround}%</li>"</SPAN> <SPAN class="operator token">+</SPAN>
<SPAN class="string token">"<li>Habitat Status: {OfficialQH:status}</li></ul>"</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">var</SPAN> featureLayer <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">FeatureLayer</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
url<SPAN class="punctuation token">:</SPAN> <SPAN class="string token"><SPAN>"</SPAN><A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fxxx%2FMapServer%2F0" target="_blank">https://xyz/MapServer/0</A><SPAN>"</SPAN></SPAN><SPAN class="punctuation token">,</SPAN>
outFields<SPAN class="punctuation token">:</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"*"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">,</SPAN>
popupTemplate<SPAN class="punctuation token">:</SPAN> popup
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
map<SPAN class="punctuation token">.</SPAN><SPAN class="token function">add</SPAN><SPAN class="punctuation token">(</SPAN>featureLayer<SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
featureLayer<SPAN class="punctuation token">.</SPAN>refreshInterval <SPAN class="operator token">=</SPAN> <SPAN class="number token">3</SPAN><SPAN class="punctuation token">;</SPAN>
status <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>value<SPAN class="punctuation token">,</SPAN> key<SPAN class="punctuation token">,</SPAN> data<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> result <SPAN class="operator token">=</SPAN> <SPAN class="string token">""</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">switch</SPAN> <SPAN class="punctuation token">(</SPAN>value<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">case</SPAN> <SPAN class="number token">1</SPAN><SPAN class="punctuation token">:</SPAN>
result <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Yes"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">break</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">case</SPAN> <SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN>
result <SPAN class="operator token">=</SPAN> <SPAN class="string token">"No"</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">break</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN>
<SPAN class="keyword token">return</SPAN> result<SPAN class="punctuation token">;</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>