When inspecting assets, I would like to use an asset type attribute from the parent layer within the inspection form so that I can use the conditionality option to display relevant contextual information.
How can an attribute be passed to the inspection form from the parent feature layer to achieve this?
Solved! Go to Solution.
This is not supported out of the box today with just a conditional visibility expression. This is because conditional visibility expressions use the constraint Arcade profile which does not support FeatureSets. Feature Sets are the way to query other layers and tables. We do plan to expand the constraint profile to support Feature Sets in the future.
However, you could add a field to the inspection form that stores the assettype and add a form calculation that pulls the assettype from the parent layer. Then use that field to drive conditional visibility in the form.
Here's an example showing how to access the parent feature (in this case a hydrant) in a form calculation (Note this doesn't work offline and we're looking into it):
// Get the feature set for the hydrants
var hydrants = FeatureSetByRelationshipName($feature, 'wHydrant', ['*'], 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
}
This is not supported out of the box today with just a conditional visibility expression. This is because conditional visibility expressions use the constraint Arcade profile which does not support FeatureSets. Feature Sets are the way to query other layers and tables. We do plan to expand the constraint profile to support Feature Sets in the future.
However, you could add a field to the inspection form that stores the assettype and add a form calculation that pulls the assettype from the parent layer. Then use that field to drive conditional visibility in the form.
Here's an example showing how to access the parent feature (in this case a hydrant) in a form calculation (Note this doesn't work offline and we're looking into it):
// Get the feature set for the hydrants
var hydrants = FeatureSetByRelationshipName($feature, 'wHydrant', ['*'], 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
}
I primarily need this to work in an offline environment. How can I best track when this issue has been resolved?
For solutions that don't work offline yet, does that mean that when the worker is back online, the field will remain blank? Or will the field update once synced? Just trying to get my head around how it all works. Cheers,
@karyn_rosa123 If the expression doesn't work, the field will remain blank. It will not be updated via the server.
Thanks Aaron for quick replies, greatly appreciated.
I too am interested in when this will work offline. I am wanting to push some current attribute values into the inspection form as the parent point over time will have attribute changes and the inspection needs to record its state at time of inspection.
The area we work in does not have guarantied internet connectivity so will be working offline.