AnsweredAssumed Answered

Query Task : How to look for NULL?

Question asked by LucieBoucher on Feb 27, 2012
Latest reply on Mar 12, 2012 by LucieBoucher
I feel this question is really stupid, but I'm stuck...

I have adapted the sample "Find Results in Dojo Chart" fom the Sample page : http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/find_map_datagrid.html


Instead of having a text box and a search button, I have three buttons (Positive, Negative, Empty) that display different results in my datagrid.  Basically, what I want is three very simple functions : display the elements where fieldA = "Positive", where fieldA = "Negative" or where fieldA contains nothing.

I have managed the first two easily.  But now I face a very stupid situation : how do I query for empty elements?  I have no idea how to write the findParams.searchText in order to return the empty elements.  I have tried with "", with NULL, and I always have an error.

Within my function init(), I have the following code :
[HTML]        //Create the find parameters
findParams = new esri.tasks.FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0];
findParams.searchFields = ["FIELDA"];
findParams.outSpatialReference = map.spatialReference; [/HTML]

Then I have the three functions :
[HTML]
function doFindPositives() {
  findParams.searchText = "Positive";
  findTask.execute(findParams,showResults);
}

function doFindNegatives() {
  findParams.searchText = "Negative";
  findTask.execute(findParams,showResults);
}

function doFindEmpty() {
  findParams.searchText = "";
  findTask.execute(findParams,showResults);
}
[/HTML]

And later, in the <body>:
[HTML]       
<button data-dojo-type="dijit.form.Button"  data-dojo-props='onClick:function(){ doFindPositives();}, value:"Search"'>
  Positive
</button>
<button data-dojo-type="dijit.form.Button"  data-dojo-props='onClick:function(){ doFindNegatives();}, value:"Search"'>
  Negative
</button>
<button data-dojo-type="dijit.form.Button"  data-dojo-props='onClick:function(){ doFindEmpty();}, value:"Search"'>
   Empty
</button>
[/HTML]

Thank you very much for your help!

Outcomes