Query a related table offline Survery123

674
6
12-13-2022 07:09 AM
JJ_Reyes
Occasional Contributor

I have an inspection form (related repeat table) that I am launching from the parent (related feature) point feature layer via Field Maps. I would also like to have the option for the user to pick a parent point in the form from a list instead of launching the form via Field Map popup.

I could use pulldata(@layer..... in the form to get the parent points. However, the survey might be used offline, so that wouldn't work.

The data is all in one feature service, which would all be available offline. Is there a method to accessing data in a different layer in your same feature service when you are offline?

0 Kudos
6 Replies
DougBrowning
MVP Esteemed Contributor

Yes check out the FeatureSet functions in Arcade.  I do this often.  Call a related table to get an attribute then send that to the 123 form using URL parameters.  

var tbl = FeatureSetByRelationshipName($feature, "Points", ['CollectCoreSubset1'], false);
return First(tbl).CollectCoreSubset1

 

Hope that helps

0 Kudos
JJ_Reyes
Occasional Contributor

Hmmm. I can use Arcade somewhere in the XLSX file? The user will not be launching Survey123 from a FieldMap. The user would be choosing the parent record to connect the inspection to in form in Survey123 app itself. 

0 Kudos
DougBrowning
MVP Esteemed Contributor

Yes this is from Field Maps.  That is how me and others generally do it.  Use Field Maps to navigate to the correct location.  Tap parent, launch 123 form passing info to the child.  All works slick.

You could use the same concept in a 123 from though I think. Have a note field that is a URL to launch a child form passing over the key and any other info you want from the parent form.

0 Kudos
JJ_Reyes
Occasional Contributor

I see how that could work. I'd have to have a parent and a separate child form. I think the point is that there is no way to access the parent data from within the child form when offline? (even though they are in the same feature layer that would be downloaded to the device?)

0 Kudos
DougBrowning
MVP Esteemed Contributor

Correct I do not think you can query the local DB on the tablet.  Maybe with javascript?  I have not seen that done though.  

0 Kudos
JJ_Reyes
Occasional Contributor

Me either. It looks like this solution would have to be online.

pulldata("@javascript","get_globalid.js", "findCode", 'https://services1.arcgis.com/1acZBnEF9zjV0l5X/arcgis/rest/services/Building_Data_Test3/FeatureServer/0', string(${NAME}), 'GlobalID')

 

0 Kudos