Data Expression Execution Error

83
0
12-06-2021 08:43 AM
Labels (1)
JasonBaker6
New Contributor

Hello everyone,

I'm new to writing data expressions, but not to coding. I followed along with the Data Expressions 101 video https://www.youtube.com/watch?v=rowW2PistiQ And no matter what I do I'm getting an Execution Error. Is there a layer setting that I've missed? The data I'm trying to work with is only shared with my organization. I've tried uploading some dummy data that is set to public, tried as a Feature Layer as well as a WFS. That didn't help either. I was able to pull from some public layers, but none of mine work. Here is a copy of what I've got:

var portal = Portal('https://mygroup.maps.arcgis.com/');
var fcPlaced = FeatureSetByPortalItem(
        portal,
        'my_item_id',
        0,
        ['FC_ID', 'CALCULATEDLENGTH', 'CABLEPLACEDESTIMATED', 'CABLEPLACEDACTUAL'],
        false
);

var fcCombo = {
    'fields': [
        { 'name': 'FC_ID', 'type': 'esriFieldTypeString'},
        { 'name': 'CALCULATEDLENGTH', 'type': 'esriFieldTypeInteger'},
        { 'name': 'CABLEPLACEDESTIMATED', 'type': 'esriFieldTypeDate'},
        { 'name': 'CABLEPLACEDACTUAL', 'type': 'esriFieldTypeDate'}
    ],
    'geometryType': '',
    'features': []
};
console(fcCombo)
var index = 0;
//Loop through and add values
for (var feature in fcPlaced) {
    fcCombo.features[index++] = {
        'attributes': {
            'FC_ID': feature['FC_ID'],
            'CALCULATEDLENGTH': feature['CALCULATEDLENGTH'],
            'CABLEPLACEDESTIMATED': feature['CABLEPLACEDESTIMATED'],
            'CABLEPLACEDACTUAL': feature['CABLEPLACEDACTUAL']
        }
    }
}

return FeatureSet(Text(fcCombo));

 

0 Kudos
0 Replies