I am trying to sum three fields (TOTAL_MKT_VALUE, NEAR_DIST_WATER, NEAR_DIST_SEWER), while applying a factor value to the last two fields, into a new Indicator, but I get an error message "Invalid variable assignment". The three fields are all of Double Precision type. Can anyone please help me figure out what is wrong with this expression (below)?
var out_fs = { geometryType: “”, fields: [ {name: “Value”, type: “esriFieldTypeDouble”}, ], features: [] }
var v1 = $datapoint[‘TOTAL_MKT_VALUE’]
var v2 = $datapoint[‘NEAR_DIST_WATER’] * 200
var v3 = $datapoint[‘NEAR_DIST_SEWER’] * 100
var v = v1 + v2 + v3 Push(out_fs.features, {attributes: {Value: v}})
return FeatureSet(Text(out_fs))
Solved! Go to Solution.
The quotes you're using aren't the standard ' or ". Replace those and it should run properly.
var out_fs = { geometryType: '', fields: [ {name: 'Value', type: 'esriFieldTypeDouble'}, ], features: [] }
var v1 = $datapoint['TOTAL_MKT_VALUE']
var v2 = $datapoint['NEAR_DIST_WATER'] * 200
var v3 = $datapoint['NEAR_DIST_SEWER'] * 100
var v = v1 + v2 + v3;
Push(out_fs.features, {attributes: {Value: v}})
return FeatureSet(Text(out_fs))
The quotes you're using aren't the standard ' or ". Replace those and it should run properly.
var out_fs = { geometryType: '', fields: [ {name: 'Value', type: 'esriFieldTypeDouble'}, ], features: [] }
var v1 = $datapoint['TOTAL_MKT_VALUE']
var v2 = $datapoint['NEAR_DIST_WATER'] * 200
var v3 = $datapoint['NEAR_DIST_SEWER'] * 100
var v = v1 + v2 + v3;
Push(out_fs.features, {attributes: {Value: v}})
return FeatureSet(Text(out_fs))
Thank you Ken. I found out the problem is that my layer is a map image layer, and the Arcade script only works for Feature service layers.