Query data from separate feature service in Survey123

660
8
07-29-2020 03:15 PM
AdrianDoss
New Contributor III

We have a Survey123 form for vehicle inspections. Vehicle data is kept separately (manufacturer, model, etc.) in another corporate application, which we can query into a feature class/service. Each vehicle is identified in our system by an ID (eg. AF123).

What I would like to accomplish is when doing a vehicle inspection using Survey123 and the ID is entered, the separate feature service is queried to bring in vehicle details.

I have read that this is possible using pulldata() and/or javascript but have been unable to find an example. I am proficient in javascript.

Does anyone have an example they are willing to share? I am using the latest release candidate of Survey123.

0 Kudos
8 Replies
Philip-Wilson
Esri Frequent Contributor

Hi Adrian,

Yes, the best way to achieve this is using pulldata @ javascript. There is a VIN Lookup example in the Early Adopter Community attached to the JavaScript documentation about how this has been done. With the 3.10 release due for release later this week, pulldata @ javascript will be fully supported in Connect, the field app and the web app.

Regards,

Phil.

0 Kudos
AdrianDoss
New Contributor III

Hi Phil

I have a use case where I have a Survey123 based on a feature service. The form is for pre-start checks on vehicles. I want to pull vehicle data from a non-spatial table hosted in our portal. Is there something analogous to feature services for non-spatial table data? And can I query it via pulldata()?

Cheers

Adrian

0 Kudos
Philip-Wilson
Esri Frequent Contributor

Hi Adrian,

Yes, using a custom JS function you should be able to query your non-spatial table hosted in your portal to return the needed values.

Regards,

Phil.

0 Kudos
AdrianDoss
New Contributor III

Thanks Phil. So I can publish a table from an mxd in ArcMap / ArcGis Desktop as a service just as I would a feature class?

0 Kudos
Philip-Wilson
Esri Frequent Contributor

Do you mean to use the table you publish from ArcMap / ArcGIS Desktop as a service to query? Yes, if you can write a custom JS function (you will need to write your own code to that and ensure the table is accessible and you have credentials etc) and can access that database and table on same network, you should be able to return the values from the table query, and pass them back into the survey form using pulldata @ JS into a text box.

Phil.

0 Kudos
AdrianDoss
New Contributor III

Yes, that's right, I want to publish it as a service. I thought services had to be a spatial layer, but I think you can publish a hosted table? I think that's the terminology.

0 Kudos
Philip-Wilson
Esri Frequent Contributor

Hi Adrian,

Yes, if you publish it as a hosted table, you should be able to query it via a custom JS function.

Phil.

0 Kudos
HarmondSantos1
New Contributor II

Hi Phil,

Just checking if it's possible to query via a custom JS function a layer which sits on our GIS server - not hosted on Portal?

Harmond

0 Kudos