Select to view content in your preferred language

A Form from feature layer that is related to another feature layer (one to many) shows only child fields

178
4
4 weeks ago
AhmadAlhaid
New Contributor

I created a parent feature layer (title, globalid) obviously i enabled global ids

then i created a child feature layer (subtitle, parentguid), i enabled attachments in the child layer

 

then i created relationship class:
relationship type: composite
messages: None
attributed: false
Origin primary key: globalid
Origin foreign key: parentguid

i published the parent layer, child layer, and the child_attach table all in one feature service

when i created a form out of this feature service, it only recognized the child fields and its attachment.

the desired final output is one form for the parent and repeat that contain child form fields, but it didn't work with me at all

where was my mistake?

Tags (1)
0 Kudos
4 Replies
ChristopherCounsell
MVP Frequent Contributor

The foreign key needs to be 'parentglobalid'

You also need to ensure the forward and backward path labels in the relationship class are identical. Be careful as there is a bug with ArcGIS online exports that strips this label.

Personally I'd recommend creating the service via connect to see how the service schema should be setup, then use that as your base.

TylerGraham2
Frequent Contributor

If you look at the settings tab for the survey in Connect, make sure the form_id column is pointing the survey to the correct table. 

For example, if you have a parent feature layer named "Feature1" and a child layer/table named "Child2" and you want the survey to start with the parent layer, in the form_id column it needs to say "Feature1" to collect data in the parent layer.  The child layer would be called as a repeat with the name of the child layer, so the repeat would need to be named "Child2" in the survey.   

0 Kudos
ChristopherCounsell
MVP Frequent Contributor

The user is creating a form from the existing service, not setting the form_id manually. Survey123 isn't recognising the relationship/layer as desired. It should be fine to be left blank if targeting the parent layer

@AhmadAlhaid the parent layer should also the first layer in your service e.g. FeatureServer/1, with the repeat below it e.g. /2

TylerGraham2
Frequent Contributor

I agree, it "should" but sometimes it doesn't, especially if you have a feature service with multiple layers and relates, so it is worth a check.  

0 Kudos