Select to view content in your preferred language

Arcade Script Not working in ArcGIS Pro 3.2

1096
5
Jump to solution
12-26-2023 05:23 AM
Labels (2)
HarishKV
Regular Contributor

Arcade script which working good with ArcGIS Pro 3.1 is not working with ArcGIS Pro 3.2. Is it a known Bug? 

@HusseinNasser2 

0 Kudos
1 Solution

Accepted Solutions
HusseinNasser2
Esri Contributor

No known issues in 3.2, all scripts should just work.

Looking at the code I see you are using a variable LBCode where it is not defined, this might be a bug in 3.1 that we fixed in 3.2 (we start detecting undefined variables), you might have meant to use attributeValue  instead.   

thanks

 

I would suggest for performance avoiding using the count here and just do  first and check for null and only ask for you are using. here is the rewritten script with the LBCode fixed.

var intersectLayer = FeatureSetByName($datastore, "Lsgd_Boundary", ['LBCode'], false);
var attributeName = 'LBCode';

var intersectingFeatures = Intersects(intersectLayer, $feature);
var intersectedFeature = First(intersectingFeatures);
if (intersectedFeature == null) return 'NA'; 

var attributeValue = intersectedFeature[attributeName];

// Generate a unique sequence number
var id = NextSequenceValue("uniqueid");

// Concatenate LBCode and the unique sequence number
var projectID = attributeValue  + "-" + id;

return projectID;
 

 

 

 

 

View solution in original post

5 Replies
DanPatterson
MVP Esteemed Contributor

Including the script in your question would be useful. 


... sort of retired...
HarishKV
Regular Contributor

I dont think its retired. Cant find any traces of it in release note.

anyways adding code for reference

var intersectLayer = FeatureSetByName($datastore, "Lsgd_Boundary");
var attributeName = 'LBCode';

var intersectingFeatures = Intersects(intersectLayer, $feature);

if (Count(intersectingFeatures) > 0) {
var intersectedFeature = First(intersectingFeatures);
var attributeValue = intersectedFeature[attributeName];

// Generate a unique sequence number
var id = NextSequenceValue("uniqueid");

// Concatenate LBCode and the unique sequence number
var projectID = LBCode + "-" + id;

return projectID;
} else {
return 'NA';
}

0 Kudos
HusseinNasser2
Esri Contributor

No known issues in 3.2, all scripts should just work.

Looking at the code I see you are using a variable LBCode where it is not defined, this might be a bug in 3.1 that we fixed in 3.2 (we start detecting undefined variables), you might have meant to use attributeValue  instead.   

thanks

 

I would suggest for performance avoiding using the count here and just do  first and check for null and only ask for you are using. here is the rewritten script with the LBCode fixed.

var intersectLayer = FeatureSetByName($datastore, "Lsgd_Boundary", ['LBCode'], false);
var attributeName = 'LBCode';

var intersectingFeatures = Intersects(intersectLayer, $feature);
var intersectedFeature = First(intersectingFeatures);
if (intersectedFeature == null) return 'NA'; 

var attributeValue = intersectedFeature[attributeName];

// Generate a unique sequence number
var id = NextSequenceValue("uniqueid");

// Concatenate LBCode and the unique sequence number
var projectID = attributeValue  + "-" + id;

return projectID;
 

 

 

 

 

HarishKV
Regular Contributor

@HusseinNasser2 

That works. Thank for support.

0 Kudos
HarishKV
Regular Contributor

@HusseinNasser2 some of these codes when i am publishing data is having a problem in execution. Sometimes giving NULL value

0 Kudos