Select to view content in your preferred language

Calculated expression works in ArcGIS Online but failing in Field Maps 24.1.0 Build 1055

496
2
Jump to solution
03-03-2024 03:23 PM
BronwenHughes
New Contributor III

I have a point layer that contractors use to record the status of plantings. Initially, contractors record an observation for each plant. If the plant needs to be replaced, they click on their observation point and record the planting details at the time of replanting. The calculated expression will automatically update the symbology of the point from the value recorded in the ObsStatus field to the domain value "Alive Healthy" (by updating the value in the Current Status field using the arcade script). My issue is that the script works in ArcGIS Online, but not in Field Maps 24.1.0. Why?

 

var replantingdate = $feature.ReplantDate
var currentstatus = $feature.CurrentStatus
var obsstatus = $feature.ObsStatus
if (!isEmpty(replantingdate)) {  
  return "Alive healthy"
} else {
 return currentstatus = obsstatus
}

 

BronwenHughes_0-1709507733954.pngBronwenHughes_1-1709507764000.pngBronwenHughes_2-1709507781598.png

 

0 Kudos
2 Solutions

Accepted Solutions
KPyne
by
Occasional Contributor

Is CurrentStatus the name of the field you are applying the calculation to? If so, you can probably just return $feature.ObsStatus in your else statement.

Also, dates don't play nice with isEmpty for some reason. Try "if (replantingdate >0)"

View solution in original post

BronwenHughes
New Contributor III

Thank you! Those suggested changes worked. The amended script now works in Field Maps:  

var replantingdate = $feature.ReplantDate
var currentstatus = $feature.CurrentStatus
var obsstatus = $feature.ObsStatus
if (replantingdate >0) {  
  return "Alive healthy"
} else {
 return $feature.ObsStatus
}

View solution in original post

0 Kudos
2 Replies
KPyne
by
Occasional Contributor

Is CurrentStatus the name of the field you are applying the calculation to? If so, you can probably just return $feature.ObsStatus in your else statement.

Also, dates don't play nice with isEmpty for some reason. Try "if (replantingdate >0)"

BronwenHughes
New Contributor III

Thank you! Those suggested changes worked. The amended script now works in Field Maps:  

var replantingdate = $feature.ReplantDate
var currentstatus = $feature.CurrentStatus
var obsstatus = $feature.ObsStatus
if (replantingdate >0) {  
  return "Alive healthy"
} else {
 return $feature.ObsStatus
}
0 Kudos