AnsweredAssumed Answered

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

Question asked by michel.turmelcgi on Oct 16, 2020
Latest reply on Oct 19, 2020 by rscheitlin

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?