<?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: Pass selected data to new view in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183995#M4313</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can anyone explain a bit about how query works?&amp;nbsp; Specifically how to get the selected feature into a variable to pass to a new view?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Clinton&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Aug 2013 11:42:51 GMT</pubDate>
    <dc:creator>ClintonCooper1</dc:creator>
    <dc:date>2013-08-22T11:42:51Z</dc:date>
    <item>
      <title>Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183994#M4312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am trying to build a flex mobile application where after I select a desired feature to edit, it passes that data to a new view for editing.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am able to get the feature to select using the query method:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
public function map_mapClickHandler(event:MapMouseEvent):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryMapClick.geometry = event.mapPoint;
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataMap.selectFeatures(queryMapClick); 
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMap.infoWindow.hide();
&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;with the Query defined as:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;

fx:Declarations&amp;gt;

&amp;nbsp; &amp;lt;esri:Query id="queryMapClick"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields="[StopId]"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnGeometry="false"/&amp;gt;

&amp;lt;/fx:Declarations&amp;gt;

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I understand how to use the navigator to push the view along with the data to the next view.&amp;nbsp; My issues, is I am not sure how to tgrab that selected data and get it in a form to get over to the next view.&amp;nbsp; Is this just a matter of creating a new var for the selected feature's attributes?&amp;nbsp; If so how do I go about doing that?&amp;nbsp; Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Aug 2013 14:07:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183994#M4312</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2013-08-20T14:07:55Z</dc:date>
    </item>
    <item>
      <title>Re: Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183995#M4313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Can anyone explain a bit about how query works?&amp;nbsp; Specifically how to get the selected feature into a variable to pass to a new view?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Clinton&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 11:42:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183995#M4313</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2013-08-22T11:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183996#M4314</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ok,after some more research and trial and error, I have gotten it to pass something to the next view using the Query Task Declaration with this code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

&amp;lt;fx:Script&amp;gt;
&amp;nbsp; &amp;lt;![CDATA[
&amp;nbsp;&amp;nbsp; import com.esri.ags.events.FeatureLayerEvent;
&amp;nbsp;&amp;nbsp; import com.esri.ags.events.MapMouseEvent;
&amp;nbsp;&amp;nbsp; import com.esri.ags.geometry.MapPoint;
&amp;nbsp;&amp;nbsp; import com.esri.ags.layers.TiledMapServiceLayer;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; import mx.controls.Alert;
&amp;nbsp;&amp;nbsp; import mx.events.FlexEvent;
 
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; public function layerShowHandler(event:FlexEvent):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; var tiledLayer:TiledMapServiceLayer = event.target as TiledMapServiceLayer;
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMap.lods = tiledLayer.tileInfo.lods;
&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; public function map_mapClickHandler(event:MapMouseEvent):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the selection query based on the click
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; queryMapClick.geometry = event.mapPoint;
&amp;nbsp;&amp;nbsp;&amp;nbsp; dataMap.selectFeatures(queryMapClick); // default selectionMethod is FeatureLayer.SELECTION_NEW
&amp;nbsp;&amp;nbsp;&amp;nbsp; myMap.infoWindow.hide();
&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; protected function myFeatureLayer_selectionCompleteHandler(event:FeatureLayerEvent):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (event.featureLayer.numGraphics &amp;gt; 0)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; queryTask.execute(queryMapClick);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; else
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Alert.show("Sorry found nothing here...");
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; ]]&amp;gt;
 &amp;lt;/fx:Script&amp;gt;
 
 &amp;lt;fx:Declarations&amp;gt;
&amp;nbsp; &amp;lt;esri:QueryTask id="queryTask"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; executeComplete="navigator.pushView(EditorView2, event.featureSet)"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; showBusyCursor="false"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; url="http://rta-gis:6080/arcgis/rest/services/temp/trial/MapServer/0"/&amp;gt;
&amp;nbsp; &amp;lt;esri:Query id="queryMapClick"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; outFields="[Stopid]"
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; returnGeometry="false"/&amp;gt;
 &amp;lt;/fx:Declarations&amp;gt;
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After I select an item and when it goes to the next view it is shows up as [object:Object] when I run the app.&amp;nbsp; Am I missing a data bind or is something not defined?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is my code for View2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;

&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;s:View xmlns:fx="http://ns.adobe.com/mxml/2009" 
&amp;nbsp; xmlns:s="library://ns.adobe.com/flex/spark" 
&amp;nbsp; xmlns:esri="http://www.esri.com/2008/ags"
&amp;nbsp; title="EditorView2"&amp;gt;
&amp;nbsp; 
 &amp;lt;fx:Script&amp;gt;
&amp;nbsp; &amp;lt;![CDATA[
&amp;nbsp;&amp;nbsp; import com.esri.ags.FeatureSet;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; import mx.collections.ArrayList;
&amp;nbsp;&amp;nbsp; import mx.collections.IList;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; [Bindable]
&amp;nbsp;&amp;nbsp; private var listProvider:IList;
&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp; override public function set data(value:Object):void
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; super.data = value;
&amp;nbsp;&amp;nbsp;&amp;nbsp; const featureSet:FeatureSet = value as FeatureSet;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (featureSet)
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listProvider = new ArrayList(featureSet.attributes);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }

&amp;nbsp; ]]&amp;gt;
 &amp;lt;/fx:Script&amp;gt;
 
 &amp;lt;fx:Declarations&amp;gt;
&amp;nbsp; &amp;lt;!-- Place non-visual elements (e.g., services, value objects) here --&amp;gt;
 &amp;lt;/fx:Declarations&amp;gt;
 
 &amp;lt;s:List id="list"
&amp;nbsp;&amp;nbsp; left="0" right="0" top="0" bottom="0"
&amp;nbsp;&amp;nbsp; dataProvider="{listProvider}"
&amp;nbsp;&amp;nbsp; interactionMode="touch"
&amp;nbsp;&amp;nbsp; labelField="StopID"/&amp;gt;

 &amp;lt;s:Button x="174" y="141" label="Go Back" click="navigator.activeView.navigator.popView()"/&amp;gt;
 
&amp;lt;/s:View&amp;gt;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 09:21:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183996#M4314</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2021-12-11T09:21:14Z</dc:date>
    </item>
    <item>
      <title>Re: Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183997#M4315</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Clinton,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;You might consider passing the array directly from the pushView function.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So instead of &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;navigator.pushView(EditorView2, event.featureSet)&lt;/PRE&gt;&lt;BR /&gt;&lt;SPAN&gt;you could use&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;navigator.pushView(EditorView2, event.featureSet.attributes)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Another solution albeit a more involved one would be to use a sort of MVC solution and declare an array in a model which you could then reference directly from multiple views. So on your execute complete of the query you could set the public array in your model equal to your event attributes. This way might require more explaining if interested but could save some headaches in the long run.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 16:20:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183997#M4315</guid>
      <dc:creator>IsaiahAguilera</dc:creator>
      <dc:date>2013-08-22T16:20:16Z</dc:date>
    </item>
    <item>
      <title>Re: Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183998#M4316</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have used&amp;nbsp; FindTask to do similar concept, I think you need to send the queryResult to View2 using the pushView Method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;mapView.pushView(map, findTaskResults, null, null);&lt;/PRE&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Or&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;executeComplete="navigator.pushView(QueryResultsView, event.featureSet)"&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Check this forum also:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/89899-Flex-Mobile-FindTask-amp-SplitViewNavigator"&gt;http://forums.arcgis.com/threads/89899-Flex-Mobile-FindTask-amp-SplitViewNavigator&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Aug 2013 16:26:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183998#M4316</guid>
      <dc:creator>KomanDiabate</dc:creator>
      <dc:date>2013-08-22T16:26:15Z</dc:date>
    </item>
    <item>
      <title>Re: Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183999#M4317</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Clinton,&lt;BR /&gt;You might consider passing the array directly from the pushView function.&amp;nbsp; &lt;BR /&gt;So instead of &lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;navigator.pushView(EditorView2, event.featureSet)&lt;/PRE&gt;&lt;BR /&gt;you could use&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;navigator.pushView(EditorView2, event.featureSet.attributes)&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Another solution albeit a more involved one would be to use a sort of MVC solution and declare an array in a model which you could then reference directly from multiple views. So on your execute complete of the query you could set the public array in your model equal to your event attributes. This way might require more explaining if interested but could save some headaches in the long run.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I would be interested in hearing more about the MVC solution.&amp;nbsp; I think I understand where you are going with it, but an explanation and maybe point me to an example of what you mean would be great!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Clinton&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 12:44:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/183999#M4317</guid>
      <dc:creator>ClintonCooper1</dc:creator>
      <dc:date>2013-08-23T12:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Pass selected data to new view</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/184000#M4318</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Sure,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;MVC stands for Model-View-Controller it's a coding practice used by many different languages. There are different frameworks you can use to accomplish this. If you would like to just use the model portion you could avoid the framework part although it would be beneficial for you to try the whole concept. For the model portion you would create an action script class file named model.as then you could create a singlton instance of it which would hold all the variables you wanted to use globally. You could then reference or bind to them anywhere in your app. If you learn controllers it's like the model but instead of variables it holds the functions. It's definitely something that can take your coding to the next level. The best examples and framework for flex I have found is here. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://thunderheadxpler.blogspot.com/2011/10/micro-architecture-for-flex-ria-and-rma.html"&gt;http://thunderheadxpler.blogspot.com/2011/10/micro-architecture-for-flex-ria-and-rma.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mansour Raad explains it very well. Check it out.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Aug 2013 15:05:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/pass-selected-data-to-new-view/m-p/184000#M4318</guid>
      <dc:creator>IsaiahAguilera</dc:creator>
      <dc:date>2013-08-23T15:05:52Z</dc:date>
    </item>
  </channel>
</rss>

