Select to view content in your preferred language

Show unlinked text in field of popup

438
1
Jump to solution
12-13-2022 10:18 AM
TimHayes3
Frequent Contributor

I have an attribute expression that is a conditional statement. In my code below, I need to have 'TBD' shown as not linked text. Currently, when this expression shows up in the popup, 'TBD' is linked to my webmap. Any ideas on how to ensure 'TBD' does not show as linked text? 

 

var link = 'www.myurl.com'
if ($feature.RESOURCETYPE == "Type 2")
return link
if ($feature.RESOURCETYPE == "Type 3")
return link
else 'TBD'
0 Kudos
1 Solution

Accepted Solutions
RhettZufelt
MVP Notable Contributor

You should look at the if syntax in the documentation.  you are missing the curly brackets enclosing the result part.

Since both Types will return the same thing, could also just see if it is included in a list and return what you want:

 

var link = 'www.myurl.com';
var field= $feature.RESOURCETYPE;
var arr = ["Type 2", "Type 3"];

if (Includes(arr, field)){
   return link
   } else {
   return 'TBD'}

 

Could also use the Decode function (though, not as easy to add to/modify the list:

 

Decode($feature.RESOURCETYPE, "Type 2", "www.myurl.com",
                              "Type 3", "www.myurl.com", "TBD")

 

R_

 

View solution in original post

1 Reply
RhettZufelt
MVP Notable Contributor

You should look at the if syntax in the documentation.  you are missing the curly brackets enclosing the result part.

Since both Types will return the same thing, could also just see if it is included in a list and return what you want:

 

var link = 'www.myurl.com';
var field= $feature.RESOURCETYPE;
var arr = ["Type 2", "Type 3"];

if (Includes(arr, field)){
   return link
   } else {
   return 'TBD'}

 

Could also use the Decode function (though, not as easy to add to/modify the list:

 

Decode($feature.RESOURCETYPE, "Type 2", "www.myurl.com",
                              "Type 3", "www.myurl.com", "TBD")

 

R_