Variable is assigned but never used (Arcade Question)

2357
10
Jump to solution
01-12-2023 02:29 PM
TimHayes3
Frequent Contributor

I have written an Arcade expression, it has 3 variables named link1, link2, and link3. When I test it in Map Viewer Classic, it says that these variables are assigned but never used. Can someone assist me in helping determine what is wrong with the syntax of my code? (I also tried the same expression except using Decode with same results, says variable assigned but never used)

var link1 = 'https://rtlt.preptoolkit.fema.gov/Public/Resource/ViewFile/9-508-1192?type=Pdf&s=Name&p=7'
var link2 = 'https://rtlt.preptoolkit.fema.gov/Public/Resource/ViewFile/9-508-1192?type=Pdf&s=Name&p=7'
var link3 = 'https://rtlt.preptoolkit.fema.gov/Public/Resource/ViewFile/9-508-1192?type=Pdf&s=Name&p=7'
if ($feature.RESOURCETYPE == "Type II (500 - 1,999 persons)")
return link1 = 'Type II';
if ($feature.RESOURCETYPE == "Type III (250 - 499 persons)")
return link2 = 'Type III';
If ($feature.RESOURCETYPE == "Type IV (249 or fewer persons)")
return link3 = 'Type IV';

 

variable is assigned but never used.png

 

var link = 'https://rtlt.preptoolkit.fema.gov/Public/Resource/ViewFile/9-508-1192?type=Pdf&s=Name&p=7'
var t = Decode($feature.RESOURCETYPE,
'Type II (500 - 1,999 persons)', 'Type II (500 - 1,999 persons)',
'Type III (250 - 499 persons)', 'Type III (250 - 499 persons)',
'Type IV (249 or fewer persons)', 'Type IV (249 or fewer persons)',
'')

If ($feature.RESOURCETYPE != "TBD - Leave Blank"){
return link = t
}

 

0 Kudos
10 Replies
TimHayes3
Frequent Contributor

Rhett and Doug thank you for your assistance. I found what I needed in an earlier post from December: https://community.esri.com/t5/arcgis-online-questions/arcade-add-url-to-pop-up/m-p/1240570#M49331 

 

0 Kudos