Using Calculated Expressions with Related Records in ArcGIS Field Maps

2669
2
12-16-2022 09:35 AM
Labels(2)
KaitlinFinan
Esri Contributor

Have you ever wanted to automatically populate attribute information into new feature to save time and mitigate mistakes? It's possible with calculated expressions in ArcGIS Field Maps! This video was recorded using ArcGIS Field Maps in August 2022. For more information about common calculated expressions and examples,click here.
For further field data management training, check out Esri's Field Data Collection and Management Using ArcGIS course:https://bit.ly/3EyRgd0

Here is some similar code you can copy and paste:

// Get the feature set for the hydrants
var hydrants = FeatureSetByRelationshipName($feature, 'wHydrant', ['facilityid'], true)

// Get the first hydrant (should only be one)
var hydrant = First(hydrants)

// If there was a hydrant, return the facilityid of it,
// Otherwise, return null
if (!IsEmpty(hydrant)) {
return hydrant['facilityid']
} else {
return null
}

2回答
莎尔onUngerer_DNREC
New Contributor II

Can you use the relationship name to pull in related records for items that are published to ArcGIS servers? I have a map service with feature service enabled published and then I added the feature service to ArcGIS Online organizaiton via URL. Secured it with stored credentials. And Now I am looking to call upon a point layer in the pop-up for a related table for site visits. I want to do something similar to what you show here where I pull in the site id. Only I keep getting and error.

Test execution error: Compilation error - Line : 1, 45: Identifier not recognised. Verify test data.
I have also tried adapting the code for the IIF statement instead of an if else. No luck. Wondering if it is a limitation of arcade/fieldmaps.
0Kudos
KaitlinFinan
Esri Contributor

Hi Sharon,

You should be able to use the FeatureSetByRelationshipName function with that set-up. Someone mentions a similar scenario in the comments tothis post: There may be a different issue going on - do you want to share your code and we can take a look?

0Kudos