Query Data Without Map

848
6
Jump to solution
06-13-2014 04:51 AM
jaykapalczynski
Frequent Contributor
I am trying to get this sample to work....the example from ESRI works of course
https://developers.arcgis.com/javascript/jssamples/query_nomap.html

I created a JSFiddle

http://jsfiddle.net/Jaykapalczynski/N8M2q/10/

then added my Map Service and Query Definition
Only other thing I changed was the value of the Value <input type="text" id="stateName" value="Potomac River"> which I verified was a legit value for this field.
After these two changes I am NOT able to get to the "ALERT 3" inside the Function showResults(results)

The Map Service has Map, Query, Data as Operations Allowed.

My questions are:

  1. Why does this not work with my Map Service...is there something that I am missing here?

  2. I am not seeing where the query is targeting a specific field? The value I am lloking for is in the "WATERBODY" field

  3. Lastly: Can this be modified to query more than one field/value?

Thanks
0 Kudos
1 Solution

Accepted Solutions
MuditAgarwal
New Contributor III
Hi,

Please try this way. same is working fine.

fiddle Link

View solution in original post

0 Kudos
6 Replies
jaykapalczynski
Frequent Contributor
THink I got it working....BRB .....
0 Kudos
MuditAgarwal
New Contributor III
Hi,

Please try this way. same is working fine.

fiddle Link
0 Kudos
jaykapalczynski
Frequent Contributor
Thanks Mudit Agarwal...
Question....


  1. how would I add more than one field in the query WHERE

  2. How would I show more fields in the result?

0 Kudos
jaykapalczynski
Frequent Contributor
I got the additional fields like this for the WHERE clause

function execute () {
          alert("1");  
          //query.text = dom.byId("stateName").value;
            query.where = 
                "Class = '"+dom.byId("stateName").value+"' AND Type = 'R' AND County = 'Franklin' ";
          alert(dom.byId("stateName").value);  
          queryTask.execute(query, showResults);
        }


Now just trying to show more fields in the Result..how do I grab and display those?

THANKS





UPADTE:

GO the extra fields by listing them in the
        query.outFields = [
            "OBJECTID","BARRIER_FR","SITENAME",
            "WATERBODY","CLASS","ACCESSAREA",
            "TYPE","NO_OFRAMPS","COUNTY","LOCATION",
            "Lat","Long","Number"  
        ]; 


THANKS A TON...got it now...
0 Kudos
jaykapalczynski
Frequent Contributor
One last question....replaced my Map Service with a Secured Map Service....the credential window opens and I type the Correct User and Password but no results....

Any thoughts?  Something I need to add to deal with Secured Services?

THanks again
0 Kudos
jaykapalczynski
Frequent Contributor
GOT IT....with your help of course....

The WHERE clause seemed to fix and issues with the Secured Services....dont know how dont care....it works...lol..

Thanks again...HAVE A GREAT WEEKEND
0 Kudos