I would like to return the values, good or bad, depending on if a value of a field in the related table matches a value in a field in the parent table. The two values are pressure in PSI and I am using the field maps web designer. Here is my code so far below
// load the related rows, using the name of the relationship class
var related_rows = FeaturesetByRelationshipName($feature, "GIS.SDE.tbl_Valve_FieldPressure")
// get the latest survey
var latest_survey = First(OrderBy(related_rows, "created_date DESC"))
// return a default value if no survey was found
if(latest_survey == null) {
return "Not surveyed yet"
}
// return good or bad depending on PSI
if(latest_survey.InputPostValvePressure == latest_survey.TargetPSI) {
return "Good"
}
return "Bad"Essentially, surveyors are entering an input PSI in the related table, and then I want a calculated field in the parent layer to grab the latest survey's input PSI and compare it to a field in the parent layer called Target PSI which already has a value in it. If the value in input PSI matches Target PSI return good, if they don't match return bad.
The code seems to work in the web designer. but when I go in field maps to test it just says failed to calculate. Anyone have any idea?