Select to view content in your preferred language

Unexpected Null error only when trying to save rule

1737
10
Jump to solution
07-18-2023 11:54 AM
CraigCarsley
Frequent Contributor

I spoke with @HusseinNasser2 at the conference about an issue with my Arcade expression. Using his sample, I'm trying to recreate my rule, starting with a simple intersect. Ultimately, this rule will include intersections with multiple layers, so I'm modifying the sample to use a results dictionary. 

I'm running into a problem when I try to save the attribute rule. It validates fine when I'm in the Expression editor, and console messages show a valid result. However, when I click 'Save', I'm presented with the following error: 

ERROR 002717: Invalid Arcade expression, Arcade error: Unexpected null, Script line: 8

var fs = FeatureSetByName($datastore,"City_Limits",["TOWN"],false);
var intFs = Intersects(fs, Geometry($feature));
var cityLimit = First(intFs)

return {
   'result':{
      'attributes':{
         'MUNICIPALITY':cityLimit.TOWN
      }
   }
}

 

As I said, the Expression validates normally in the Editor:

CraigCarsley_0-1689706188920.png

and the console message >> console(cityLimit.TOWN) yields:

CraigCarsley_1-1689706244453.png

If I print the entire results dictionary to the console, I get this:

{"result":{"attributes":{"MUNICIPALITY":"Omaha"}}}

 

Any ideas why I'm having a problem here?

0 Kudos
10 Replies
CraigCarsley
Frequent Contributor

How embarrassing for me. That was the problem. 😐

Thanks Mike

0 Kudos