Select to view content in your preferred language

Pull data (JavaScript) and Update Features

536
1
03-21-2022 04:27 PM
explocarto
New Contributor III

Context:
I'm looking to update an entity class with values from a table. The goal is to count the values from the table to perform a symbology on my entity class.

Because if I'm not mistaken, it's not possible with arcade.
Arcade would just allow me to count to show that total in the popup, but not to do any symbology.

Concrete case:
I'm working with a Survey123 Connect form

With Pulldata (JavaScript), I use a Query request which counts the number of elements on a considered set of my table.

On this same JavaScript file, is it possible to perform an Update Feature request to feed my entity class with the result of my previous Query?

Thanks for your help.

0 Kudos
1 Reply
ZacharySutherby
Esri Regular Contributor

Hello @explocarto

It is possible to send an applyEdits request to a feature service directly from a JavaScript function in Survey123. I would suggest using an application called Postman which is an API development tool to narrow down the syntax needed in the applyEdits request, then translate that to your JavaScript function. 

In the JavaScript sample we have in Connect we demonstrate a few ways to work with online API's. We don't explicitly demonstrate sending an applyEdits request, but using the samples available in Connect and the working request from Postman they can be merged. An important consideration is asynchronous calls are not supported in JavaScript functions so setting the async parameter in the open() method to False is needed. 

Thank you,
Zach