I have amalgamated some datasets and now have a multitude of attributes, some of which are not relevant for all features (many more than in the below example 😕). I am looking for a way to filter the attributes in the popup using an Arcade expression. For example, referencing the table below, if a user selects a feature on a map and the value for the ‘Layer’ field is ‘A’, then display all attributes with ‘A_’ as the prefix. Similarly for all other values of ‘Layer’. So, for a feature selected which has a value of ‘B’ for the Layer attribute, the attributes ‘B_abc’ and ‘B_def’ would be shown in the popup.
I feel this can be accomplished using Arcade, but I cannot get my head around how.
Layer | A_abc | A_def | B_abc | C_abc | B_def |
A | Xyzxyz | pqrs |
|
|
|
B |
|
| Mnop |
| Defgh |
A | Xyz | Vwx |
|
|
|
C |
|
|
| xyza |
|
C |
|
|
| pqrstu |
|
B |
|
| pqrst |
| Jkl |
Thank you for any pointers.
You can use variables when getting a field from a feature. Here's an example, using the Popup profile in the Playground.
var field = 'UPDATE';
return $feature['LAST'+field]