<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to use parameterValues? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1084440#M74076</link>
    <description>&lt;P&gt;I just use basic js. Below is a small sample of how I read the url parameters and process... So just grab your parameters from url (.../index.html?param1=xx&amp;amp;param2?=yy....) and do your query. This is a code in one of my custom widgets in WAB. So you will see use of this. Another option is to use node.js.&lt;/P&gt;&lt;P&gt;PS. I posted the code using the "insert code sample" and it looks good on preview. Don't know why when it's posted it shows with no formatting. Sorry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;urlSubstring = location.search;
console.log(urlSubstring)
if (urlSubstring.includes("?")) {
  this.geturl(urlSubstring);
}
-------
------
geturl: function (urlSubstring) {
  urlSubstring = location.search.substring(1);
  if (urlSubstring.indexOf("?") &amp;gt; 0) {
   var myparams1 = urlSubstring.split('?');
   urlSubstring = myparams1[1];
  }
  if (urlSubstring) {
    var params = urlSubstring.split('&amp;amp;');
    var length = params.length;
    var i;
    var index;
    index = -1;
    for (i = 0; i &amp;lt; length; i++) {
    var variablesPair = params[i];
    if ((index = variablesPair.indexOf("=")) &amp;gt;= 0) {
      var varReceived = variablesPair.substring(0, index);
      var valueReceived = variablesPair.substring(index + 1);
        if (varReceived == "apn") {
           apn = valueReceived;
           this.gettheParcel(apn);
           }
        if (varReceived == "county") {
-----
-----&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 30 Jul 2021 17:12:12 GMT</pubDate>
    <dc:creator>LefterisKoumis</dc:creator>
    <dc:date>2021-07-30T17:12:12Z</dc:date>
    <item>
      <title>How to use parameterValues?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1084405#M74075</link>
      <description>&lt;P&gt;I am trying to execute queries on a layer based on user input. All the examples I see for doing this look something like this:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;query.where = "NAME = '" + rawUserInput + "'";&lt;/LI-CODE&gt;&lt;P&gt;I'm aware that the risk of SQL injection is something the server administrator is responsible for taking care of, however even when ignoring potential security issues, we still have inconvenient bugs to be concerned about. I will still need to think about escaping single quotes, and who knows what other special characters, before dumping them into the query.&lt;/P&gt;&lt;P&gt;It would certainly be nice if we could do properly parameterized queries. I see there's a &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#parameterValues" target="_blank" rel="noopener"&gt;parameterValues&lt;/A&gt; property I could use, however I can't actually figure out how to use it, and I see no examples anywhere in all my web searches.&lt;/P&gt;&lt;P&gt;Are parameterized queries even possible? Can I have an example?&lt;/P&gt;&lt;P&gt;&lt;A href="https://stackoverflow.com/q/68579214/138757" target="_blank" rel="noopener"&gt;Related StackOverflow question&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.reddit.com/r/gis/comments/al4979/arcgis_api_for_javascript_querytask_sql_injection/" target="_blank" rel="noopener"&gt;Related Reddit thread&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 14:24:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1084405#M74075</guid>
      <dc:creator>pcrock</dc:creator>
      <dc:date>2021-07-30T14:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to use parameterValues?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1084440#M74076</link>
      <description>&lt;P&gt;I just use basic js. Below is a small sample of how I read the url parameters and process... So just grab your parameters from url (.../index.html?param1=xx&amp;amp;param2?=yy....) and do your query. This is a code in one of my custom widgets in WAB. So you will see use of this. Another option is to use node.js.&lt;/P&gt;&lt;P&gt;PS. I posted the code using the "insert code sample" and it looks good on preview. Don't know why when it's posted it shows with no formatting. Sorry.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;urlSubstring = location.search;
console.log(urlSubstring)
if (urlSubstring.includes("?")) {
  this.geturl(urlSubstring);
}
-------
------
geturl: function (urlSubstring) {
  urlSubstring = location.search.substring(1);
  if (urlSubstring.indexOf("?") &amp;gt; 0) {
   var myparams1 = urlSubstring.split('?');
   urlSubstring = myparams1[1];
  }
  if (urlSubstring) {
    var params = urlSubstring.split('&amp;amp;');
    var length = params.length;
    var i;
    var index;
    index = -1;
    for (i = 0; i &amp;lt; length; i++) {
    var variablesPair = params[i];
    if ((index = variablesPair.indexOf("=")) &amp;gt;= 0) {
      var varReceived = variablesPair.substring(0, index);
      var valueReceived = variablesPair.substring(index + 1);
        if (varReceived == "apn") {
           apn = valueReceived;
           this.gettheParcel(apn);
           }
        if (varReceived == "county") {
-----
-----&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Jul 2021 17:12:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1084440#M74076</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2021-07-30T17:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to use parameterValues?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1085059#M74103</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;Just a quick note on the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-Query.html#parameterValues" target="_self"&gt;parameterValues&lt;/A&gt;. This parameter can only be used with ArcGIS map service that was published from a query layer. We will update the document to clarify this point.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/help/mapping/layer-properties/creating-a-query-layer.htm" target="_self"&gt;This document&lt;/A&gt; talks about how to create a query layer in ArcGIS Pro and &lt;A href="https://developers.arcgis.com/rest/services-reference/enterprise/query-map-service-layer-.htm" target="_self"&gt;this rest api doc&lt;/A&gt; explains what parameterValues is.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this clarifies what parameterValues does.&amp;nbsp;&lt;/P&gt;&lt;P&gt;-Undral&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 19:14:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-use-parametervalues/m-p/1085059#M74103</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2021-08-02T19:14:03Z</dc:date>
    </item>
  </channel>
</rss>

