All,
I have a map with a point feature (Gas Leak) and a related table (Leak Monitor)
I am working on using calculated expressions to "Classify" the leak on initial discovery, and update that same classification based on continous leak monitors. So basically, when a leak is discovered, the class will be decided for the user based on other attributes they fill out. That code works perfectly fine. Before it evaluates this class however, it checks to see if any related "Leak Monitors" exist, and if so, what the updated class from those entries is. I've done multiple expressions to pull information from related records and am pretty comfortable with it. Where things seem to be hanging up is when these records do not exist. I have tried using !IsEmpty(RelatedMonitors), !is NaN(RelatedMonitors) and the count method shown below. No matter what I try, if there are no related monitors, it only tells me that it failed to calculate in field maps on IOS. It seems to work as intended in the expression builder in AGOL when I test. But will not work on iPhone. It's almost like it doesn't know if related records exist yet? Hoping someone can help me figure out what is going on here. Thanks
// Pull the NewLeakClass fields from all related records.
var RelatedMonitors = featuresetbyrelationshipname($feature, 'LeakMonitor',['NewLeakClass'],False)
//take the first record from all related records
var NewestMonitor = First(RelatedMonitors)
//Count number of related records
var NumRelMons = Count(RelatedMonitors)
//if the count is not 0, then it tells me there are monitors
if (NumRelMons != 0){
return "YesMon"
//if the count is 0 then, it tells me there are no monitors
}else {
return "NoMon"
}
Solved! Go to Solution.
See my last post in this thread from just yesterday https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-featuresetbyrelationshipname-ar...
Basically featuresetbyrelationshipname is buggy and you should use ByName.
I wish we could sticky posts. Hope that helps
See my last post in this thread from just yesterday https://community.esri.com/t5/arcgis-field-maps-questions/field-maps-featuresetbyrelationshipname-ar...
Basically featuresetbyrelationshipname is buggy and you should use ByName.
I wish we could sticky posts. Hope that helps
I have used both methods and seem to get the same error. I generally use the ByName method and then filter by GlobalId and GUID to get my related records. However, I think I am seeing that the issue may be related to me using the GlobalID as the key field. I have tried creating a test map using a LeakID that auto increments, and that seems to work. I'm guessing the GlobalID is not created until after the feature is submitted, and therefore there is nothing to filter by, causing havok.
Of course there is the possiblity that I am completely wrong. If this Leak ID method starts to show any instabilities or problems, I will read through the rest of that thread and see if I can find something else I am doing wrong.
I'm guessing the GlobalID is not created until after the feature is submitted, and therefore there is nothing to filter by, causing havok.
Correct!
Cool, since that is how my relationship was keyed, that is why I could not get it to work. I will key off of a new field and go from there. I think someone else having this issue may find this useful so I will mark your original post as a solution.
Thanks!