6

In ArcGIS Online, I have a point layer with attributes Provider1, Provider2, Provider3.....Provider13. The values are text consisting of people's names.

I would like to configure the popup to concatenate the Providers separated by a semi-colon. However, some points only have a value for Provider1. Other points only have a value for Provider1 and Provider2. Other points only have a value for Provider1, and Provider2, and Provider3... etc.

Currently I simply have:

Concatenate($feature.PROVIDER1, ';', $feature.PROVIDER2, ';', 
$feature.PROVIDER3,';', $feature.PROVIDER4,';',$feature.PROVIDER5)

But for points that have only Provider1, the popup shows:

John J. Doe; ; ; ;

Is there a way to to have the expression "stop" trying to concatenate when it encounters an empty Provider value?

1
  • Yes is the short answer, you want to be studying the logic functions here. May be the IIF or When functions?
    – Hornbydd
    Commented Nov 8, 2017 at 23:22

1 Answer 1

7

You must test IsEmpty for each value. You may try this code using the Labeling Profile at the Arcade Playground

//Array to hold values and an index
var i = 0;
var features = [];

//Add value to array if not empty
function addvalue(feat) {
    if (!IsEmpty(feat)) {
        features[i++] = feat;
    }
}

//Add your values
addvalue($feature.name1);
addvalue(Null);
addvalue($feature.name2);
addvalue("");
addvalue("text");

//Return a concatenated string
return Concatenate(features, ";")

This will return:

value1;value2;text

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.