Select to view content in your preferred language

Arcade Label Expression causing ArcPro to be unresponsive after update..new to arcade expression

630
1
Jump to solution
02-04-2020 10:13 AM
AlexanderLynch2
Occasional Contributor

Is my code unsuitable as a label expression? My ArcPro project is unresponsive after applying the arcade script. I have a feeling I messed up and created an infinity loop? I am not too sure as I normally use FME for post-processing...Essentially it's looking at fields 1-5 for domain coded value 'FALSE'. If value found, then concatenate and display label values in JointCompany_n [company name].

Also, is there one location and resource/guide/book on arcade? I am getting frustrated with how many tabs are open just to find information on which function, operator, and logical are being used...

//create labels for all_jointattachment layer by commtransfer value
var i = 0
var features = []
//create function to filter from comm transferred field
function addvalue(feat) {
if (RIGHT(feat,5)=='FALSE') {
features[i++] = feat;
}
}

//add value from field commtransferred and filter out ones with false
addvalue($feature.JointCompany_1+$feature.CommTransferred_1)
addvalue($feature.JointCompany_2+$feature.CommTransferred_2)
addvalue($feature.JointCompany_3+$feature.CommTransferred_3')
addvalue($feature.JointCompany_4+$feature.CommTransferred_4)
addvalue($feature.JointCompany_5+$feature.CommTransferred_5)
//returns all features where value is false

return Concatenate (Replace(features,'FALSE',''), ";")

 

Thank you!!!!

0 Kudos
1 Solution

Accepted Solutions
AlexanderLynch2
Occasional Contributor

Not sure why it makes ArcPro unresponsive but was able to make expression work declaring var at end of script.

//create labels for all_jointattachment layer by commtransfer value
var i = 0
var features = []
//create function to filter from comm transferred field
function addvalue(feat) {
if (RIGHT(feat,5)=='FALSE') {
features[i++] = feat;
}
}

//add value from field commtransferred and filter out ones with false
addvalue($feature.JointCompany_1+$feature.CommTransferred_1)
addvalue($feature.JointCompany_2+$feature.CommTransferred_2)
addvalue($feature.JointCompany_3+$feature.CommTransferred_3')
addvalue($feature.JointCompany_4+$feature.CommTransferred_4)
addvalue($feature.JointCompany_5+$feature.CommTransferred_5)
//returns all string company names for features where value is false

var lbl = Concatenate (Replace(features,'FALSE',''), ";")
return(lbl)

View solution in original post

0 Kudos
1 Reply
AlexanderLynch2
Occasional Contributor

Not sure why it makes ArcPro unresponsive but was able to make expression work declaring var at end of script.

//create labels for all_jointattachment layer by commtransfer value
var i = 0
var features = []
//create function to filter from comm transferred field
function addvalue(feat) {
if (RIGHT(feat,5)=='FALSE') {
features[i++] = feat;
}
}

//add value from field commtransferred and filter out ones with false
addvalue($feature.JointCompany_1+$feature.CommTransferred_1)
addvalue($feature.JointCompany_2+$feature.CommTransferred_2)
addvalue($feature.JointCompany_3+$feature.CommTransferred_3')
addvalue($feature.JointCompany_4+$feature.CommTransferred_4)
addvalue($feature.JointCompany_5+$feature.CommTransferred_5)
//returns all string company names for features where value is false

var lbl = Concatenate (Replace(features,'FALSE',''), ";")
return(lbl)

0 Kudos