Select to view content in your preferred language

ArcGIS Field Maps arcade editor Concatenate

1415
11
Jump to solution
04-19-2023 01:57 AM
GIS_Ecologist
Occasional Contributor

Good morning Community,

I have been working with ArcGIS for a number of year but have only just started to venture into creating my own more complicated content. Specifically survey forms and asset inspection reports.

 

I am using Field Maps to create a asset inspection reporting system. My result is to change the symbology based on if the asset has been inspected. I have already defined a symbology that needs to be viewed by the field workers. 

 

The solution to this is to create a new field with a concatenated input and define the symbology based on this. I have the following fields;

$feature.CUT_REGIME
$feature.Parcel_State
 
I would like the end result to read
 
$feature.CUT_REGIME ' - ' $feature.Parcel_State
 
if $feature.Parcel_State is blank/empty then I would like it to read 'incomplete'
 
I see that this may be a simple piece of Arcade for someone and would really appreciate some help.
 
Thanks very much.
 
At the moment i have managed to put the following together but it is not working.
 
Concatenate($feature.CUT_REGIME,
IsEmpty(
// Returns true(' - ','Incomplete')
// Returns false(' - ',$feature.Parce_State')
))));
0 Kudos
1 Solution

Accepted Solutions
Jake_S
by Esri Contributor
Esri Contributor

Hector,

This may be what you are looking for then. 

if(IsEmpty($feature.Status)){
    return $feature.SCC_ID
}
return $feature.SCC_ID + '-' + $feature.Status

View solution in original post

11 Replies
Jake_S
by Esri Contributor
Esri Contributor

Hector,

Give this a go. 

if(IsEmpty($feature.CUT_REGIME)){
    return $feature.Parcel_State + ' - Incomplete'
}
return $feature.CUT_REGIME + ' - ' + $feature.Parcel_State
0 Kudos
GIS_Ecologist
Occasional Contributor

Good afternoon,

 

Thanks for the quick reply, it is much appreciated. I will try this now.

 

Do you know if this type of expression can be set to be a recurring calculation based on a set time period. For example every 60 seconds.

 

Kind regards

0 Kudos
Jake_S
by Esri Contributor
Esri Contributor

Hector,


Attribute rules trigger on insert, update, or delete. So some action would be required to the feature this rule is applied to. There is no way to trigger rules directly by a timer. Batch calculation rules also would not work because batch calculation and validation rules are evaluated at a user-specified time using the Error Inspector or the Evaluate Rules tool. So this would require a person to click and review every 60 seconds. 

That being said, I have seen organizations add a field to the feature class and have a script that runs via task manager that updates that field with some arbitrary value. This will trigger attribute rules that do not have any restrictors that prevent an update when edited (e.g. below)

if (($editcontext.editType == "UPDATE" && Equals(Geometry($originalFeature),Geometry($feature)))) {
return ;
}

 

Additionally, the rule provided to you would trigger if $feature.CUT_REGIME was updated at any time. So if one of the field workers updated that field

~Jake

0 Kudos
GIS_Ecologist
Occasional Contributor

Hi Jake,

 

In this particular case, workers would be updating the '$feature.Parcel_State' field with whether it has been completed or not.

 

Where would I put this expression? My assumption would be to create a 'text - single line' form element, set the field calculated value and then input the expression into that.

 

Would that be correct?

 

 

I have been playing around with changing the symbology of the web map to show if parcels have been completed or not but this doesn't seem to be the most efficient way of doing this.

0 Kudos
Jake_S
by Esri Contributor
Esri Contributor

Hector,

Yes you can apply this to a form element calculation.

Also you can setup rules to fire when another field is updated.

if ($editcontext.editType == "UPDATE" && ($originalFeature.Parcel_State == $feature.Parcel_State)){
     return ;

if(IsEmpty($feature.CUT_REGIME)){
    return $feature.Parcel_State + ' - Incomplete'
}
return $feature.CUT_REGIME + ' - ' + $feature.Parcel_State

In the rule above if the feature is being updated AND the original Parcel_State is the same as the current value don't do anything. So this means is there is an update to the feature and the Parcel_State has changed run the rule.

~jake

0 Kudos
GIS_Ecologist
Occasional Contributor

Hi Jake,

 

If I wanted the field to display the '$feature.CUT_REGIME' alone and then update it with a '- Complete' once the '$feature.Parcel_State' is update by the worker.

 

This would allow me to set the symbology based off this field alone and it would capture everything I need.

It is displaying an error at the moment.

EcologistHector_0-1681914331055.png

 

 

Thanks so much for the help.


Kind regards,

Hector

0 Kudos
Jake_S
by Esri Contributor
Esri Contributor

Hector,

The error at the moment is caused by the code missing a } after the first return. add a } to line 3.

~Jake

0 Kudos
Jake_S
by Esri Contributor
Esri Contributor

Hector,

I'm a bit confused now to what you are looking to populate in the CUT_REGIME field.

Your original post said you wanted $feature.CUT_REGIME ' - ' $feature.Parcel_State but now you want $feature.CUT_REGIME' alone and then update it with a '- Complete'?

~jake

0 Kudos
GIS_Ecologist
Occasional Contributor

Hi Jake,

 

Yes apologies, I see the mistake I made. I was trying to populate the wrong field. Thank you for noticing.

 

I have amended the expression to:

1. $feature.SCC_ID+
2. '-'+
3. $feature.Status
 
This is working to populate the text I need. However, I require lines 2 and 3 to not appear if '$feature.Status' is blank.
 
Slightly simpler expression than what I thought I needed.
 
Kind regards.

 

0 Kudos