I need help - Javascript - query.where

1020
2
08-29-2014 12:20 PM
hussambukhari
New Contributor

I'm still new for ESRI, I need your help, I'm using esri.tasks.query.where but my where is more than 2600 char, and it will not work in IE below is the snap of code, it will return SyntaxError: Syntax error can any one help

!DOCTYPE html>

html>

head>


<meta http-equiv="Content-Type" content="text/html; charset=utf-8">


<!--The viewport meta tag is used to improve the presentation and behavior of the samples

<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">


<title>Query (with a POST)</title>


<script src="//js.arcgis.com/3.10/"></script>


<script>


"esri/tasks/query", "esri/tasks/QueryTask", "esri/config",

"dojo/dom", "dojo/on", "dojo/domReady!"


function (Query, QueryTask, esriConfig, dom, on) {

//need to reference a working proxy here, dropbox doesn't allow you to host proxies


"/DotNet/proxy.ashx";

//you can either explicitly include 'http' or 'https' or infer the same protocol as the running application


var queryTask = new QueryTask("http://geoportal.abudhabi.ae/rest/services/HealthMapService/MapServer/1");

var query = new Query();

false;

"*"];

"execute"), "click", execute);

function execute() {

//1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1 AND 1=1


var strWhere1 = " Trim(LICENSENUMBER) in ('MF1026','MF104','MF1051','MF1102','MF118','MF1190','MF120','MF1206','MF1267','MF1286','MF1288','MF1300','MF131','MF1311','MF1329','MF1425','MF1429','MF1481','MF151','MF1518','MF1575','MF1577','MF1587','MF1589','MF1605','MF1618','MF165','MF166','MF1680','MF1690','MF170','MF175','MF1767','MF1773','MF1781','MF1835','MF1854','MF186','MF1893','MF1898','MF1901','MF1922','MF1937','MF1941','MF1942','MF1954','MF1958','MF1961','MF1962','MF1964','MF1974','MF1976','MF1989','MF2','MF2003','MF2006','MF2007','MF2021','MF2044','MF2058','MF2059','MF2066','MF2079','MF2089','MF2095','MF2096','MF2099','MF21','MF2101','MF2102','MF2125','MF213','MF2132','MF2144','MF2218','MF2250','MF2270','MF2291','MF23','MF2304','MF2320','MF2326','MF2338','MF2351','MF2377','MF2378','MF2394','MF2411','MF2426','MF2452','MF2495','MF2503','MF2522','MF2527','MF254','MF2542','MF2553','MF2555','MF2599','MF2617','MF268','MF272','MF291','MF2934','MF2958','MF3065','MF3087','MF3100','MF3104','MF313','MF3167','MF3179','MF3223','MF3226','MF3273','MF3303','MF3331','MF3335','MF351','MF3516','MF3525','MF3534','MF3580','MF3586','MF3611','MF3636','MF368','MF3693','MF3696','MF3743','MF3886','MF391','MF394','MF41','MF429','MF439','MF440','MF456','MF464','MF466','MF467','MF469','MF472','MF473','MF571','MF613','MF624','MF663','MF687','MF74','MF765','MF772','MF87','MF949','MF999')";

var strWhere = " Trim(LICENSENUMBER) in ('MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026','MF1026','MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999')";

function showResults(results) {

"info").innerHTML = "success";

function err(e) {

"info").innerHTML = e;

</script>

head>

body>


<input id="execute" type="button" value="run query">


<br />


<br />


<div id="info" style="padding:5px; margin:5px; background-color:#eee;">


</div>

body>

html>

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Hussam,

  Here is your code working for me using my proxy:

<!DOCTYPE html>

<html>

<head>

  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

  <!--The viewport meta tag is used to improve the presentation and behavior of the samples  -->

  <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">

  <title>Query (with a POST)</title>

  <script src="//js.arcgis.com/3.10/"></script>

  <script>

    require([

            "esri/tasks/query", "esri/tasks/QueryTask", "esri/config",

            "dojo/dom", "dojo/on", "dojo/domReady!"

    ], function (

            Query, QueryTask, esriConfig, dom, on

    ) {

      //need to reference a working proxy here, dropbox doesn't allow you to host proxies 

      esri.config.defaults.io.proxyUrl = "http://gislap183/Proxy/proxy.ashx";

      esri.config.defaults.io.alwaysUseProxy = true;

      //you can either explicitly include 'http' or 'https' or infer the same protocol as the running application 

      var queryTask = new QueryTask("http://geoportal.abudhabi.ae/rest/services/HealthMapService/MapServer/1");

      var query = new Query();

      query.returnGeometry = false;

      query.outfields = ["*"];

      on(dom.byId("execute"), "click", execute);

    function execute() {

      var strWhere1 = " Trim(LICENSENUMBER) in ('MF1026','MF104','MF1051','MF1102','MF118','MF1190','MF120','MF1206','MF1267','MF1286','MF1288','MF1300','MF131','MF1311','MF1329','MF1425','MF1429','MF1481','MF151','MF1518','MF1575','MF1577','MF1587','MF1589','MF1605','MF1618','MF165','MF166','MF1680','MF1690','MF170','MF175','MF1767','MF1773','MF1781','MF1835','MF1854','MF186','MF1893','MF1898','MF1901','MF1922','MF1937','MF1941','MF1942','MF1954','MF1958','MF1961','MF1962','MF1964','MF1974','MF1976','MF1989','MF2','MF2003','MF2006','MF2007','MF2021','MF2044','MF2058','MF2059','MF2066','MF2079','MF2089','MF2095','MF2096','MF2099','MF21','MF2101','MF2102','MF2125','MF213','MF2132','MF2144','MF2218','MF2250','MF2270','MF2291','MF23','MF2304','MF2320','MF2326','MF2338','MF2351','MF2377','MF2378','MF2394','MF2411','MF2426','MF2452','MF2495','MF2503','MF2522','MF2527','MF254','MF2542','MF2553','MF2555','MF2599','MF2617','MF268','MF272','MF291','MF2934','MF2958','MF3065','MF3087','MF3100','MF3104','MF313','MF3167','MF3179','MF3223','MF3226','MF3273','MF3303','MF3331','MF3335','MF351','MF3516','MF3525','MF3534','MF3580','MF3586','MF3611','MF3636','MF368','MF3693','MF3696','MF3743','MF3886','MF391','MF394','MF41','MF429','MF439','MF440','MF456','MF464','MF466','MF467','MF469','MF472','MF473','MF571','MF613','MF624','MF663','MF687','MF74','MF765','MF772','MF87','MF949','MF999')";

      var strWhere = " Trim(LICENSENUMBER) in ('MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF1026','MF1026','MF1026', 'MF1026', 'MF1026', 'MF1026', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999', 'MF999')";

      query.where = strWhere1;

      queryTask.execute(query, showResults, err);

    };

      function showResults(results) {

        dom.byId("info").innerHTML = "success";

      }

      function err(e) {

        dom.byId("info").innerHTML = e;

      }

    });

  </script>

</head>

<body>

  <input id="execute" type="button" value="run query">

  <br />

  <br />

  <div id="info" style="padding:5px; margin:5px; background-color:#eee;">

  </div>

</body>

</html>

0 Kudos
hussambukhari
New Contributor

Hi Robert,

Thank you for replying, did you try the code above in IE 11 or 10, its working fine form me for both chrom and firefox but not IE.

and when I check the developer tools in IE it shown the request method send as GET from proxy where in Chrom and firefox it is POST.

can you help please in this issue.

of if there is other way to call rest services with hug data other than proxy?

0 Kudos