I have a Field Maps application to inventory trees. The application's associated web map has the following features associated with it:
Layers
Tables
I created the 'trees_related' table to allow for certain fields in the Field Map app to auto-calculate (genus, species, functional group, native/non-native), based on a shared 'commonname' field. Initially, I had a related table called 'names_genus_species' that had the same information as trees_related. I preferred the brevity of the name 'trees_related', so went with that table instead.
Now to my issue: I have four fields in my trees point layer that are auto-calculated based on fields in the related table. Originally, I wrote the expressions to use the 'names_genus_species' table. All four expressions are structurally identical. The only difference between them is the reference to the relevant field in the related table. For instance, the expression to evaluate for species name:
var related_table = FeatureSetByName($datastore, "names_genus_species", ["commonname", "species"], true); var common_name = $feature.commonname; var matched_feature = First(Filter(related_table, "commonname = @common_name")); return iif(!IsEmpty(matched_feature), matched_feature['species'], 'Unknown');
This works fine. It continues to work despite the fact that the 'names_genus_species' table is NO LONGER part of the web map $datastore. Again, I removed it and replaced it with 'trees_related'.
However, when I use the same code structure and replace the related table name so that the expression contains the table that actually is part of the $datastore in the web map, the code returns an error. For example, when I run:
var related_table = FeatureSetByName($datastore, "trees_related", ["commonname", "species"], true); var common_name = $feature.commonname; var matched_features = First(Filter(related_table, "commonname = @common_name")); return iif(!IsEmpty(matched_feature), matched_feature['species'], 'Unknown');
I am met with this error: Test execution error: Execution error - Invalid parameter. Verify test data.
I am bewildered and would greatly appreciate guidance from anyone who better understands what might be going on here.