<?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: Passing additional parameters to a function within identifyResults in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78579#M7155</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I understand correctly, you can also pass it what I believe is referred to as a function maker.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var _funcMaker = function(type) { &amp;nbsp; return function(queryResults) { &amp;nbsp;&amp;nbsp;&amp;nbsp; // do something with results based on type &amp;nbsp;&amp;nbsp;&amp;nbsp; // that was passed to it &amp;nbsp; }; }; findTask.execute(findParams, _funcMaker("find"));&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The _funcMaker function will take any 'extra' params you want to use and return the function that processes the queryResults.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 17 Oct 2012 20:02:56 GMT</pubDate>
    <dc:creator>ReneRubalcava</dc:creator>
    <dc:date>2012-10-17T20:02:56Z</dc:date>
    <item>
      <title>Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78577#M7153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;First, I admit that I only have limited "hands on" experience programming with Javascript. So, I apologize for any ignorance. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a function that dynamically creates a DOJO table with the results of an identifyTask and a findTask. If the user performs a findTask, I want to send in a parameter to my "buildTable" function so that the map extent is changed to the extent of the findTask results. If "buildTable" is called using identifyTask, I don't want the map's extent to change to the results. This is part of my working code below:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;identifyTask.execute(identifyParams, buildTable); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function buildTable(queryResults){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...do work }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;findTask.execute(findParams, buildTable);&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, "buildTable" has no idea what function called it, whether the identifyTask or the findTask, so I'm trying to implement an additional parameter for "buildTable", a type string, identifying what method is calling it. Unfortunately, due to my limited experience using Javascript, I cannot get my following code to work. What I don't understand is: currently, "buildTable" is called without passing it a parameter (no parenthesis), so how does my parameter queryResults receive data?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;identifyTask.execute(identifyParams, buildTable(queryResults,"identify")); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; function buildTable(queryResults, method){ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...do work and make my table from queryResults }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;findTask.execute(findParams, buildTable(queryResults,"find"));&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The code above obviously doesn't work, as I receive "queryResults is not defined", so how exactly can I get something like my above example to work? Or, does somebody have a better method to use so "buildTable" knows what task was used so it can do appropriate work?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Andrew&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 18:03:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78577#M7153</guid>
      <dc:creator>AndrewBrown1</dc:creator>
      <dc:date>2012-10-17T18:03:39Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78578#M7154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;the syntax i use is&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt; 
var task = new esri.tasks.QueryTask(url);
task.execute(q, dojo.hitch(this, "searchCallback", linklayer, layerdesc, titleField, outfields, zoomScale, linkField));&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and the callback (note this is in a widget, so the format is a little different)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;searchCallback: function(layerId, layerdesc, titleField, fields, zoomScale, linkField, featureSet ) {
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:01:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78578#M7154</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2021-12-10T23:01:46Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78579#M7155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If I understand correctly, you can also pass it what I believe is referred to as a function maker.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var _funcMaker = function(type) { &amp;nbsp; return function(queryResults) { &amp;nbsp;&amp;nbsp;&amp;nbsp; // do something with results based on type &amp;nbsp;&amp;nbsp;&amp;nbsp; // that was passed to it &amp;nbsp; }; }; findTask.execute(findParams, _funcMaker("find"));&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The _funcMaker function will take any 'extra' params you want to use and return the function that processes the queryResults.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 17 Oct 2012 20:02:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78579#M7155</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2012-10-17T20:02:56Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78580#M7156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This works! Thank you very much!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;If I understand correctly, you can also pass it what I believe is referred to as a function maker.&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var _funcMaker = function(type) {
&amp;nbsp; return function(queryResults) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // do something with results based on type
&amp;nbsp;&amp;nbsp;&amp;nbsp; // that was passed to it
&amp;nbsp; };
};
findTask.execute(findParams, _funcMaker("find"));
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The _funcMaker function will take any 'extra' params you want to use and return the function that processes the queryResults.&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:01:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78580#M7156</guid>
      <dc:creator>AndrewBrown1</dc:creator>
      <dc:date>2021-12-10T23:01:48Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78581#M7157</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;i like my way better, &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt; but glad you found a solution that works for you.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;please mark odoe's post as the answer.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 18:00:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78581#M7157</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2012-10-18T18:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78582#M7158</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I don't see the "check" that is supposed to be under the "up/down vote" on the right side. I turned off adblock plus and it's still not there. How do I mark it as "answered"?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 18:51:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78582#M7158</guid>
      <dc:creator>AndrewBrown1</dc:creator>
      <dc:date>2012-10-18T18:51:14Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78583#M7159</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;are you logged in? only the thread creator, logged in, can mark as answered&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 18:58:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78583#M7159</guid>
      <dc:creator>JeffPace</dc:creator>
      <dc:date>2012-10-18T18:58:08Z</dc:date>
    </item>
    <item>
      <title>Re: Passing additional parameters to a function within identifyResults</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78584#M7160</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It doesn't show up in Chrome. Once I switched to Firefox, the big "check" showed up.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 18 Oct 2012 19:05:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/passing-additional-parameters-to-a-function-within/m-p/78584#M7160</guid>
      <dc:creator>AndrewBrown1</dc:creator>
      <dc:date>2012-10-18T19:05:15Z</dc:date>
    </item>
  </channel>
</rss>

