Where do the Arcade Console messages go to?

6072
8
Jump to solution
05-12-2021 09:44 AM
RalfSchmidt
New Contributor III

In ArcGIS Pro, when I use Arcade in an Attribute Rule or in a Label Expression, where do I see the messages I create using the "Console()" function?

Tags (2)
2 Solutions

Accepted Solutions
Brian_Wilson
Occasional Contributor III

I asked this exact question (for labels not attribute rules but I am sure it's the same) in an instructor-led class yesterday. The short version of the answer is that the messages go nowhere. They go to standard output but unless Esri catches standard output and sends it someplace they just disappear.

I will be starting on developing attribute rules in a few days. It appears environment for test and debug for Arcade is pretty much non-existent.

View solution in original post

HildermesJoséMedeirosFilho
New Contributor III
 
calcfield.jpg

I'd recommend the approach above. I do this using attribute rules, using Calculate Field-Arcade. (Don't  forget it, press Verify icon first)

View solution in original post

Tags (1)
8 Replies
RalfSchmidt
New Contributor III

In the meantime I tried the following:

  • I used SysInternals's program "DbgView" to check if the messages go there.
  • I started Pro from the command line. But no message appear there.
  • I got so desperate that I actually looked at the "Python Window" and the "Geoprocessing History". Of course with no success.

Common, Esri staff! Please at least tell me that these messages go nowhere. (And if so, please tell me how do you debug Attribute Rules.)

Brian_Wilson
Occasional Contributor III

I asked this exact question (for labels not attribute rules but I am sure it's the same) in an instructor-led class yesterday. The short version of the answer is that the messages go nowhere. They go to standard output but unless Esri catches standard output and sends it someplace they just disappear.

I will be starting on developing attribute rules in a few days. It appears environment for test and debug for Arcade is pretty much non-existent.

RalfSchmidt
New Contributor III

Thanks for sharing this information with me, though it is very sobering. I fear I will need to put any debug message into a string attribute of the feature being edited.

Brian_Wilson
Occasional Contributor III

That's a good idea.

First impression: There is no way to extend Arcade, to improve it, or to call functions, or to load libraries. You can import or export a code block but you can't do it dynamically so there is no easy way to use an external IDE. 

 

EStauber
New Contributor

I have the same problem when debugging attribute rules.  Although not as useful as console(), the dictionary keyword “errorMessage “ does help me.  You can create a long custom message without having to worry how to display it, because It will show up in the error window.  Example:  return {"errorMessage": "this will show up in the error window."} "

 https://pro.arcgis.com/en/pro-app/latest/help/data/geodatabases/overview/attribute-rule-dictionary-k... 

HildermesJoséMedeirosFilho
New Contributor III
 
calcfield.jpg

I'd recommend the approach above. I do this using attribute rules, using Calculate Field-Arcade. (Don't  forget it, press Verify icon first)

Tags (1)
DrewDowling
Occasional Contributor III

I have also found that the ArcGIS Server log files contain the fuller error message. ArcGIS Pro usually truncates it.

 

DrewDowling_0-1655840016071.png

but the logs record it all

DrewDowling_1-1655840114255.png

 

0 Kudos
by Anonymous User
Not applicable

When iterating through a series of features, how do you know where to put the console message? I have written the following calculate expression:

 

var AssignedDate = $feature.CreationDate;
var Road = FeatureSetByName($datastore, 'Road');
var line_fs = Intersects(Road, Buffer($feature, 150, "Meters"));

// Cycle through road segments & find closest one
var min_dist = 9999
var nearest_RoadClass = null
var geo = Geometry($feature)
for(var line in line_fs) {
  var line_geo = Geometry(line)
  var dist = Distance(geo, line_geo)
  if(dist < min_dist) {
    min_dist = dist
    nearest_RoadClass = line.CLASS
}
}

Console(nearest_RoadClass)

 

and expect to see Class 6 in the console message (if you look in the attribute table, you can see that I have selected a subset of my data and both of the features are closest to a Class 6 Road) but it returns Class 5. Why? 

SHartholt_0-1672323861984.png

Moving the Console message into the curly brackets above doesn't provide the expected output either:

 

var AssignedDate = $feature.CreationDate;
var Road = FeatureSetByName($datastore, 'Road');
var line_fs = Intersects(Road, Buffer($feature, 150, "Meters"));

// Cycle through road segments & find closest one
var min_dist = 9999
var nearest_RoadClass = null
var geo = Geometry($feature)
for(var line in line_fs) {
  var line_geo = Geometry(line)
  var dist = Distance(geo, line_geo)
  if(dist < min_dist) {
    min_dist = dist
    nearest_RoadClass = line.CLASS
}
Console(nearest_RoadClass)
}

 

SHartholt_1-1672324064321.png

Moving it up one more level also returns the Class 5 Class 5 Class 5 output:

 

var AssignedDate = $feature.CreationDate;
var Road = FeatureSetByName($datastore, 'Road');
var line_fs = Intersects(Road, Buffer($feature, 150, "Meters"));

// Cycle through road segments & find closest one
var min_dist = 9999
var nearest_RoadClass = null
var geo = Geometry($feature)
for(var line in line_fs) {
  var line_geo = Geometry(line)
  var dist = Distance(geo, line_geo)
  if(dist < min_dist) {
    min_dist = dist
    nearest_RoadClass = line.CLASS
Console(nearest_RoadClass)
}
}

 

0 Kudos