Hello everyone,
I'm very new to Arcade, and am working to populate an indicator from multiple feature layers.
My problem is that I have a value, called "ArrivalTime" (which is a number) that some layers have, and others don't. When I execute the code, the layers that do not have an "ArrivalTime" show this value as "null" and I cannot filter based on it, they just get excluded automatically.
My question is, I'd like to replace this "null" value by a 0, so that I can filter on them the same as the layers that do have an "ArrivalTime" value.
var Length_Canada = FeatureSetByPortalItem(port, '5ae0748d2b454853bcf47bffc3245a39', 12, ['*'], true)
var Length_Australia = FeatureSetByPortalItem(port, '44708b8c1c2f4338835e51baee64d1a9', 9, ['*'], true)
Console(Length_Australia)
Console(Length_Canada)
var combinedDict = {
'fields': [
{ name: "Shape_Length", type:"esriFieldTypeDouble" },
{ name: "ArrivalTime", type:"esriFieldTypeDouble" },
],
geometryType: "esriGeometryPolyline",
features: [],
}; var i = 0;
for (var t in Length_Canada) {
combinedDict.features[i++] = {
attributes: {
Shape_Length: t["Shape__Length"],
Arrival_Time: "0"
},
geometry: Geometry(t)
};
} for (var m in Length_Australia) {
combinedDict.features[i++] = {
attributes: {
Shape_Length: m["Shape__Length"],
ArrivalTime: m["ArrivalTime"]
},
geometry: Geometry(m)
};
}
return FeatureSet(combinedDict)
Here is the code, as the Canada layers do not have any "ArrivalTime" value, I'm trying to force a 0 as the default value (line 19), but it keeps on returning a null value.
Here is an example of the return table that I get.
Any help would be appreciated,
Thanks a lot,
Rémy