How to pass parent feature attribute to inspection form?

736
6
Jump to solution
05-05-2022 08:46 AM
OliverIshmael
Occasional Contributor

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?

0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable

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
}

 

View solution in original post

6 Replies
by Anonymous User
Not applicable

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
}

 

OliverIshmael
Occasional Contributor

I primarily need this to work in an offline environment. How can I best track when this issue has been resolved?

0 Kudos
karyn_rosa123
New Contributor III

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,

0 Kudos
by Anonymous User
Not applicable

@karyn_rosa123   If the expression doesn't work, the field will remain blank. It will not be updated via the server.

karyn_rosa123
New Contributor III

Thanks Aaron for quick replies, greatly appreciated. 

0 Kudos
GerberMatthew
New Contributor III

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. 

0 Kudos