Select to view content in your preferred language

Query (Return) All Points In Query Task and Query Object

919
4
Jump to solution
09-27-2017 09:00 AM
BehrouzHosseini
Regular Contributor

Using ArcGIS JavaScript API 3.21 I need to grab all Points on a Server. The code works for me with Query.where clause at

query.where = "FeederID = 'RMT001'";

but as I said I need to get all Points. I tried to run the query without any Query.where statement but not getting back anything. can you please let me know how to get all Points?

function execute () {
       var query = new Query();
       query.where = "FeederID  = 'RMT001'";
       query.returnGeometry = true;
       query.outFields = [ "CreationUser", "FName" ];
       queryTask.execute(query, showResults);
    } ‍‍‍‍‍‍‍
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Bengi,

   Just use:

query.where = "1=1";

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Bengi,

   Just use:

query.where = "1=1";
Mehretab
Frequent Contributor

Is all except query expression (<>) valid in the JavaScript API. I couldn't get a result of the query. 

query.where = "(NAMETEXT <> '"+valuefromcombo+"')"

I am aware it can work with successive OR statements like

query.where = "(NAMETEXT = '"+valuefromcombo+"') OR (NAMETEXT ='Havel')";

OR 

query.where = "NAMETEXT in ('xxx', 'yyyy')";‍

Note:valuefromcombo is a user impute variable and it is text to be clear if in case there is an issue of (<>) expression with text values?

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

No <> is not valid SQL. You need to use NOT Instead.

Mehretab
Frequent Contributor
query.where = "(NAMETEXT NOT LIKE 'Havel')";

Worked perfectly. Thanks Robert!!!!

0 Kudos