Hello-
I am trying to write an attribute rule that will calculate a field value by concatenating other fields. I have the basic arcade written, however, we have some variation in our table that could cause the straightforward statements to not work as I want. Here is what I need:
Prefix + Route + Week -- the field can only be 5 characters long total -- ex CC01S or D005N or CB005 or D0005
My thought is that if I can identify whether or not the following is true I can create the new concatenated field:
// First determine if there is week information
// If there is, add 'week' sufix to it
var wmWeek = null;
if (!IsEmpty($feature.CASTERBOXCARDBOARD_WEEK)){
wmWeek = LEFT($feature.CASTERBOXCARDBOARD_WEEK,1);
}
Here is what I have working so far thanks to a couple of blog posts I found:
//works, getting closer- need to figure out the prefix when 2 characters and the route 0001 vs 001 vs 01
// First determine if there is week information
// If there is, add 'week' sufix to it
var wmWeek = null;
if (!IsEmpty($feature.CASTERBOXCARDBOARD_WEEK)){
wmWeek = LEFT($feature.CASTERBOXCARDBOARD_WEEK,1);
}
//Second determin if the prefix is one or two characters
var prefix = $feature.CASTERBOXCARDBOARD_PREFIX
var route = $feature.CASTERBOXCARDBOARD_ROUTE
if (prefix is >1){
}
//List of fields to combine
var parts =[$feature.CASTERBOXCARDBOARD_PREFIX,$feature.CASTERBOXCARDBOARD_ROUTE,wmWeek];
//loop through parts, if null/empty add to new array
var filteredparts =[];
for (var i in parts) {
var value = parts[i];
if (isEmpty(value)) continue;
filteredparts[Count(filteredparts)] =value
}
//Concatenate
return concatenate(filteredparts,"");
any help or ideas here would be great!
Solved! Go to Solution.
@DonSjoboen see if this give you any hints!