I'm the GIS Coordinator for our County and I'm posting this question for one of my users in my organization. They have written a script that works perfectly for their needs, it locates the nearest weather station and collects the data listed on line 4 and auto fills the fields they need filled. The script is below if that will help answer the question we are posing to anyone that can help. They want this data to only populate when the point is placed on the map the first time. Later there are edits that will be done as part of the workflow to those points to update other fields as needed. The problem that comes up is that when those points are edited the data collected from the arcade script updates with the latest information from those weather stations and they need to have that data remain the same from when the point was placed not from when edits were made. Is there a way to make it so that this data only populates when a point is placed on not update when it's edited?
//er data from closest NWS station//
var searchdist =35;
var stations = Intersects(FeatureSetByName($map, 'Stations',["STATION_NAME",'DEW_POINT','OBS_DATETIME','R_HUMIDITYTEMP','TEMP','WIND_SPEED']),Buffer($feature,searchdist, "miles"));
var minDistance = 50
var nearStation;
//console(count(stations))
//return stations
for (var station in stations){
var stationDist = Round(distance(station, $feature, "miles"),3);
//var key = text(stationDist, "00.00");
console (stationDist);
//if statment to find closest station
if (stationDist < minDistance){
minDistance = stationDist;
nearStation = station;
}
}
return nearStation.station_name