1

I have data that needs to be in a pop-up that is contained across several fields. If the fields have no data, I would like the pop-up to say "No Aviation Resources". Here is what I have so far, it works except for the "No Aviation Resources" part....

var i = 0;
var features = [];

function addvalue(feat) {
    if (!IsEmpty(feat)) {
        features[i++] = feat;
    }
}
//Add your values
addvalue($feature.AirAttackSearch);
addvalue($feature.AirtankerSearch);
addvalue($feature.LeadPlaneSearch);
addvalue($feature.ReconSearch);
addvalue($feature.SmokejumperAircraftSearch);
addvalue($feature.RotorWIngSearch);
addvalue($feature.UASSearch);

IIf(IsEmpty(features), "No Aviation Resources", Concatenate(features, ";"))
1
  • Are you using Arcade with ArcGIS Pro or ArcGIS Online? – PolyGeo Apr 20 at 22:17
1

As per the Arcade documentation for IsEmpty:

IsEmpty( value ) -> Boolean
Returns true if the provided value is null or an empty string (e.g. ''). Returns false for all other cases, including empty arrays and dictionaries.

https://developers.arcgis.com/arcade/function-reference/logical_functions/#isempty

Check for a zero sized array instead

IIf(count(features)==0, "No Aviation Resources", Concatenate(features, ";"))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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