Select to view content in your preferred language

How to query a map service to ensure that the dataset/result is not empty before adding the layer to the map

438
1
10-16-2020 03:27 PM
MichelTurmel
Occasional Contributor

I am creating a widget that adds several layers on the map but before I add a layer on the map I want to make sure that the query associated to the layer does not return an empty set.

I have found an example using QueryTask to get data but this for the ArcGIS API for JavaScript. I have tried to include the code within my widget but it never gets to the  showResults function in my attached file. 

Here is my environment:

   - Portal for ArcGIS version 10.6

   - Web AppBuilder Developer Edition 2.6

   - ArcGIS JavaScript API 3.33

Is there any way for me to check if the query associated to a layer will be empty before I add the layer to the map?

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Michel,

but this for the ArcGIS API for JavaScript

Which is what WAB is built on. If you are never getting to the showResults function then you have an error in your code. Hard to tell you much more with out seeing your widget code.

0 Kudos