Select to view content in your preferred language

Pop-up Expression

130
5
Jump to solution
Wednesday
Seyed-MahdySadraddini
Regular Contributor

I have looked at several examples of arcade expressions, and have read the ESRI developer manuals online to figure out how to display fields conditionally in popups on ArcGIS Enterprise.

I would like to display 2 fields on the popup in a webmap. If my province code is greater than 59, I want to display fields x12 and x10. Else, I would like to display fields y6 and y4. So, I am trying to display different fields based on the value of another field.

 

 

Here is a psuedo-arcade code that does not work! I understand the return statement is not correct

 

var prov = $feature.province_code;

field1 = IIf(prov > 59, $feature.both_rate_12, $feature.both_rate_6)

field2 = IIf(prov > 59, $feature.both_rate_10, $feature.both_rate_4)

return field1, field2
 
 
Would you please help me re-write this code so it works! 
0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

This solution uses template literals and an implicit return

IIf(
  $feature.province_code > 59,
  `${$feature.both_rate_12}, ${$feature.both_rate_10}`,
  `${$feature.both_rate_6}, ${$feature.both_rate_4}`
);

 

View solution in original post

5 Replies
KenBuja
MVP Esteemed Contributor

This solution uses template literals and an implicit return

IIf(
  $feature.province_code > 59,
  `${$feature.both_rate_12}, ${$feature.both_rate_10}`,
  `${$feature.both_rate_6}, ${$feature.both_rate_4}`
);

 

Seyed-MahdySadraddini
Regular Contributor

Thanks for your suggestion. I adjusted my code according to your suggestion, but it still does not display any of the fields on the pop-up!

Not sure what could be the reason there.

0 Kudos
KenBuja
MVP Esteemed Contributor

Can you provide screen shots of your data? And do you want to show the fields as a comma-separated string ("Field1, field2") or a field list like this?

Snag_d8fca5.png

 

0 Kudos
Seyed-MahdySadraddini
Regular Contributor

The actual field names are too long, so I'm afraid the screen shot won't show much.

But all the fields are numeric.

Preferably I like to show the fields in table format, like your screen shot. Different provinces show respective values in different fields  in my data; that is why I need to customize it to show different fields for different provinces.

I wonder if the version of the enterprise I am using would be a factor, 11.3

0 Kudos
Seyed-MahdySadraddini
Regular Contributor

I just realized why! Thanks for your help @KenBuja 

0 Kudos