<?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 Getting a value from multiple functions in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/getting-a-value-from-multiple-functions/m-p/32475#M775</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Im having an issue due to async functions on my widget&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN&gt;&amp;lt;viewer:BaseWidget xmlns:fx="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http://ns.adobe.com/mxml/2009" target="_blank"&gt;http://ns.adobe.com/mxml/2009&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:s="library://ns.adobe.com/flex/spark"
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:mx="library://ns.adobe.com/flex/mx"
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:viewer="com.esri.viewer.*"&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:components="com.esri.viewer.components.*"
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:esri="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http://www.esri.com/2008/ags" target="_blank"&gt;http://www.esri.com/2008/ags&lt;/A&gt;&lt;SPAN&gt;"&amp;nbsp; initialize="basewidget1_initializeHandler(event)" creationComplete="basewidget1_creationCompleteHandler(event)"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;

&amp;nbsp; &amp;lt;fx:Declarations&amp;gt;
&amp;nbsp; &amp;lt;s:GlowFilter id="glowFilter"
&amp;nbsp;&amp;nbsp; alpha="1"
&amp;nbsp;&amp;nbsp; color="{getStyle('focusColor')}"
&amp;nbsp;&amp;nbsp; inner="true"
&amp;nbsp;&amp;nbsp; strength="2"/&amp;gt;

&amp;nbsp; &amp;lt;s:DateTimeFormatter id="dateFormatter" dateTimePattern="dd/MM/yyyy"/&amp;gt;
&amp;nbsp; &amp;lt;/fx:Declarations&amp;gt;

&amp;nbsp; &amp;lt;fx:Script&amp;gt;
&amp;nbsp; &amp;lt;![CDATA[
&amp;nbsp; import com.esri.ags.FeatureSet;
&amp;nbsp; import com.esri.ags.Graphic;
&amp;nbsp; import com.esri.ags.tasks.QueryTask;
&amp;nbsp; import com.esri.ags.tasks.supportClasses.Query;

&amp;nbsp; import flash.utils.setTimeout;

&amp;nbsp; import mx.collections.ArrayCollection;
&amp;nbsp; import mx.controls.Alert;
&amp;nbsp; import mx.events.FlexEvent;
&amp;nbsp; import mx.rpc.AsyncResponder;
&amp;nbsp; import mx.rpc.Responder;

&amp;nbsp; import widgets.AdmIngresoClientes.utilidad.urls;
&amp;nbsp; [Bindable] public var idPosteNuevo:String;
&amp;nbsp; [Bindable] public var idDirNueva:String;
&amp;nbsp; [Bindable] public var rotNuevo:String;
&amp;nbsp; [Bindable] public var dirNueva:String;

&amp;nbsp; [Bindable] public var coleccionClientes:ArrayCollection = new ArrayCollection;
&amp;nbsp; [Bindable] public var fs:FeatureSet = new FeatureSet;
&amp;nbsp; [Bindable] public var rotu:int;

&amp;nbsp; protected function basewidget1_initializeHandler(event:FlexEvent):void
&amp;nbsp; {


&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp; coleccionClientes.removeAll();
&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp; var queryTask:QueryTask = new QueryTask(widgets.AdmIngresoClientes.utilidad.urls.URL_ADD_CLIENTE);
&amp;nbsp; var query:Query = new Query();
&amp;nbsp; query.where = "1=1";
&amp;nbsp; query.outFields = ['*'];
&amp;nbsp; query.orderByFields = ['created_date'];
&amp;nbsp; query.returnGeometry = true;
&amp;nbsp; queryTask.execute(query, new AsyncResponder(onResultQuery, onFaultQuery));



&amp;nbsp; function onResultQuery(featureSet:FeatureSet, token:Object = null):void
&amp;nbsp; {
&amp;nbsp; var k:int;


&amp;nbsp; for(k=0;k&amp;lt;featureSet.features.length;k++)
&amp;nbsp; {
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "nuevo") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "nueva") ){&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; idPosteNuevo = "calcular ID Poste";
&amp;nbsp; rotNuevo = "calcular rotulo";
&amp;nbsp; idDirNueva = "calcular ID Dir";
&amp;nbsp; dirNueva = "calcular direccion nombre";
&amp;nbsp; }
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "nuevo") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "existente") ) {&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; idPosteNuevo = "calcular ID Poste";
&amp;nbsp; rotNuevo = "calcular rotulo";
&amp;nbsp; idDirNueva = featureSet.features&lt;K&gt;.attributes["ID_DIRECCION"];&lt;/K&gt;
&amp;nbsp; dirNueva = "calcular direccion nombre";
&amp;nbsp; }
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "existente") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "nueva") ) {&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; idPosteNuevo = featureSet.features&lt;K&gt;.attributes["ID_POSTE_CAMARA"];&lt;/K&gt;
&amp;nbsp; rotNuevo = "calcular rotulo";
&amp;nbsp; idDirNueva = "calcular ID Dir";
&amp;nbsp; dirNueva = "calcular direccion nombre";
&amp;nbsp; }
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "existente") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "existente") ) {&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; rotNuevo = buscarRotulo(featureSet.features&lt;K&gt;.attributes["ID_POSTE_CAMARA"]);&lt;/K&gt;
&amp;nbsp; idDirNueva = featureSet.features&lt;K&gt;.attributes["ID_DIRECCION"];&lt;/K&gt;

&amp;nbsp; }

&amp;nbsp; var recordGraphic:Graphic = featureSet.features&lt;K&gt;;&lt;/K&gt;
&amp;nbsp; coleccionClientes.addItem({OBJECTID:recordGraphic.attributes["OBJECTID"], 
&amp;nbsp; NIS:recordGraphic.attributes["NIS"],
&amp;nbsp; NUMERO_MEDIDOR:recordGraphic.attributes["NUMERO_MEDIDOR"],
&amp;nbsp; TIPO_POSTE_CAMARA:recordGraphic.attributes["TIPO_POSTE_CAMARA"],
&amp;nbsp; ID_POSTE_CAMARA:String(idPosteNuevo),
&amp;nbsp; TIPO_DIRECCION:recordGraphic.attributes["TIPO_DIRECCION"],
&amp;nbsp; ID_DIRECCION:String(idDirNueva),
&amp;nbsp; ROTULO:String(rotNuevo),
&amp;nbsp; gra:recordGraphic});
&amp;nbsp; }

&amp;nbsp; }
&amp;nbsp; function onFaultQuery(info:Object, token:Object = null):void
&amp;nbsp; {&amp;nbsp;&amp;nbsp; 
&amp;nbsp; Alert.show("Error en consulta","Carga de Clientes");
&amp;nbsp; }
&amp;nbsp; }


&amp;nbsp; public function buscarRotulo(idp:String):String{
&amp;nbsp; var rt:String;
&amp;nbsp; var queryTask:QueryTask = new QueryTask(widgets.AdmIngresoClientes.utilidad.urls.URL_ROTULOS);
&amp;nbsp; var query:Query = new Query();
&amp;nbsp; query.where = "id_nodo="+ idp;
&amp;nbsp; query.outFields = ['rotulo'];
&amp;nbsp; query.returnGeometry = false;
&amp;nbsp; queryTask.execute(query, new AsyncResponder(onResultQuery2, onFaultQuery2));

&amp;nbsp; function onResultQuery2(featureSet2:FeatureSet, token:Object = null):void {

&amp;nbsp; //var recordGraphic:Graphic = featureSet2.features[index];
&amp;nbsp; rt = String(featureSet2.features[0].attributes["rotulo"]);
&amp;nbsp; // Alert.show(rotNuevo);
&amp;nbsp; }
&amp;nbsp; function onFaultQuery2(info:Object, token:Object = null):void
&amp;nbsp; {&amp;nbsp;&amp;nbsp; 


&amp;nbsp; }


&amp;nbsp; return rt;
&amp;nbsp; }


&amp;nbsp; protected function basewidget1_creationCompleteHandler(event:FlexEvent):void
&amp;nbsp; {
&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp; DataClientesNuevos.dataProvider = coleccionClientes;
&amp;nbsp; }

&amp;nbsp; ]]&amp;gt;
&amp;nbsp; &amp;lt;/fx:Script&amp;gt;
&amp;nbsp; &amp;lt;viewer:WidgetTemplate id="wTemplate"&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; width="800" height="500"
&amp;nbsp;&amp;nbsp;&amp;nbsp; visible="true"&amp;gt;

&amp;nbsp; &amp;lt;mx:Canvas id="ListadoClientes" label="Lista Clientes Nuevos" width="100%" height="100%"&amp;gt;
&amp;nbsp; &amp;lt;s:VGroup width="100%" top="5" bottom="5" height="100%"&amp;gt;
&amp;nbsp; &amp;lt;mx:Label id="Lblclie" text="Listado de Nuevos Clientes" fontSize="18"/&amp;gt;

&amp;nbsp; &amp;lt;mx:DataGrid id="DataClientesNuevos" resizableColumns="true" sortableColumns="true" editable="false"&amp;nbsp; 
&amp;nbsp; width="100%" height="100%" visible="true" selectable="true"&amp;gt;
&amp;nbsp; &amp;lt;mx:columns&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; &amp;lt;mx:DataGridColumn&amp;nbsp; dataField="OBJECTID" headerText="OBJECTID" width="30" visible="false"/&amp;gt;&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;&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;&amp;nbsp;&amp;nbsp; 

&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="NUMERO_MEDIDOR" headerText="NUMERO MEDIDOR" width="50" /&amp;gt;&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;&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;lt;mx:DataGridColumn dataField="NIS" headerText="NIS" width="50"/&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="TIPO_POSTE_CAMARA" headerText="TIPO_POSTE_CAMARA" visible="true" width="50" /&amp;gt;

&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="ID_POSTE_CAMARA" headerText="ID_POSTE_CAMARA" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="ROTULO" headerText="ROTULO" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="TIPO_DIRECCION" headerText="TIPO_DIRECCION" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="ID_DIRECCION" headerText="ID_DIRECCION" visible="true" width="50" /&amp;gt;


&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="DIRECCION_PROPIETARIO" headerText="DIRECCION PROPIETARIO" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="CALLE" headerText="CALLE" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="NUMERO" headerText="NUMERO" visible="true" width="50" /&amp;gt; 
&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; &amp;lt;/mx:columns&amp;gt;
&amp;nbsp; &amp;lt;/mx:DataGrid&amp;gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp; &amp;lt;/s:VGroup&amp;gt;
&amp;nbsp; &amp;lt;/mx:Canvas&amp;gt;
&amp;nbsp; &amp;lt;/viewer:WidgetTemplate&amp;gt;
&amp;lt;/viewer:BaseWidget&amp;gt;&lt;/PRE&gt;&lt;P&gt;The logic is:&lt;/P&gt;&lt;P&gt;the main query that u get the "numero medidor, nis, tipo tipo_direccion is from a layer)&lt;/P&gt;&lt;P&gt;The "rotulo" is a query from another layer in the service, the result has to be in the coleccionClientes arrayList, where i ask for the id_poste and it gives me the result for the rotulo.&lt;/P&gt;&lt;P&gt;I have to do the same with the direccion&amp;nbsp; , calle , and numero.&lt;/P&gt;&lt;P&gt;Since im starting to get the rotulo, my problem is i get null for the 2 rows that it has to be shown. &lt;/P&gt;&lt;P&gt;The result is this one in the attach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i do this more efficiently? Cuz the async functions from the other layer im asking has a delay between each row.&lt;/P&gt;&lt;P&gt;thanks in advice! Soon i will start changing this to javascript T -T, i promise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 21:17:13 GMT</pubDate>
    <dc:creator>EvelynHernandez</dc:creator>
    <dc:date>2021-12-10T21:17:13Z</dc:date>
    <item>
      <title>Getting a value from multiple functions</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/getting-a-value-from-multiple-functions/m-p/32475#M775</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Im having an issue due to async functions on my widget&lt;/P&gt;&lt;P&gt;My code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN&gt;&amp;lt;viewer:BaseWidget xmlns:fx="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http://ns.adobe.com/mxml/2009" target="_blank"&gt;http://ns.adobe.com/mxml/2009&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:s="library://ns.adobe.com/flex/spark"
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:mx="library://ns.adobe.com/flex/mx"
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:viewer="com.esri.viewer.*"&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:components="com.esri.viewer.components.*"
&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; xmlns:esri="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http://www.esri.com/2008/ags" target="_blank"&gt;http://www.esri.com/2008/ags&lt;/A&gt;&lt;SPAN&gt;"&amp;nbsp; initialize="basewidget1_initializeHandler(event)" creationComplete="basewidget1_creationCompleteHandler(event)"&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;gt;

&amp;nbsp; &amp;lt;fx:Declarations&amp;gt;
&amp;nbsp; &amp;lt;s:GlowFilter id="glowFilter"
&amp;nbsp;&amp;nbsp; alpha="1"
&amp;nbsp;&amp;nbsp; color="{getStyle('focusColor')}"
&amp;nbsp;&amp;nbsp; inner="true"
&amp;nbsp;&amp;nbsp; strength="2"/&amp;gt;

&amp;nbsp; &amp;lt;s:DateTimeFormatter id="dateFormatter" dateTimePattern="dd/MM/yyyy"/&amp;gt;
&amp;nbsp; &amp;lt;/fx:Declarations&amp;gt;

&amp;nbsp; &amp;lt;fx:Script&amp;gt;
&amp;nbsp; &amp;lt;![CDATA[
&amp;nbsp; import com.esri.ags.FeatureSet;
&amp;nbsp; import com.esri.ags.Graphic;
&amp;nbsp; import com.esri.ags.tasks.QueryTask;
&amp;nbsp; import com.esri.ags.tasks.supportClasses.Query;

&amp;nbsp; import flash.utils.setTimeout;

&amp;nbsp; import mx.collections.ArrayCollection;
&amp;nbsp; import mx.controls.Alert;
&amp;nbsp; import mx.events.FlexEvent;
&amp;nbsp; import mx.rpc.AsyncResponder;
&amp;nbsp; import mx.rpc.Responder;

&amp;nbsp; import widgets.AdmIngresoClientes.utilidad.urls;
&amp;nbsp; [Bindable] public var idPosteNuevo:String;
&amp;nbsp; [Bindable] public var idDirNueva:String;
&amp;nbsp; [Bindable] public var rotNuevo:String;
&amp;nbsp; [Bindable] public var dirNueva:String;

&amp;nbsp; [Bindable] public var coleccionClientes:ArrayCollection = new ArrayCollection;
&amp;nbsp; [Bindable] public var fs:FeatureSet = new FeatureSet;
&amp;nbsp; [Bindable] public var rotu:int;

&amp;nbsp; protected function basewidget1_initializeHandler(event:FlexEvent):void
&amp;nbsp; {


&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp; coleccionClientes.removeAll();
&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp; var queryTask:QueryTask = new QueryTask(widgets.AdmIngresoClientes.utilidad.urls.URL_ADD_CLIENTE);
&amp;nbsp; var query:Query = new Query();
&amp;nbsp; query.where = "1=1";
&amp;nbsp; query.outFields = ['*'];
&amp;nbsp; query.orderByFields = ['created_date'];
&amp;nbsp; query.returnGeometry = true;
&amp;nbsp; queryTask.execute(query, new AsyncResponder(onResultQuery, onFaultQuery));



&amp;nbsp; function onResultQuery(featureSet:FeatureSet, token:Object = null):void
&amp;nbsp; {
&amp;nbsp; var k:int;


&amp;nbsp; for(k=0;k&amp;lt;featureSet.features.length;k++)
&amp;nbsp; {
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "nuevo") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "nueva") ){&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; idPosteNuevo = "calcular ID Poste";
&amp;nbsp; rotNuevo = "calcular rotulo";
&amp;nbsp; idDirNueva = "calcular ID Dir";
&amp;nbsp; dirNueva = "calcular direccion nombre";
&amp;nbsp; }
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "nuevo") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "existente") ) {&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; idPosteNuevo = "calcular ID Poste";
&amp;nbsp; rotNuevo = "calcular rotulo";
&amp;nbsp; idDirNueva = featureSet.features&lt;K&gt;.attributes["ID_DIRECCION"];&lt;/K&gt;
&amp;nbsp; dirNueva = "calcular direccion nombre";
&amp;nbsp; }
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "existente") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "nueva") ) {&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; idPosteNuevo = featureSet.features&lt;K&gt;.attributes["ID_POSTE_CAMARA"];&lt;/K&gt;
&amp;nbsp; rotNuevo = "calcular rotulo";
&amp;nbsp; idDirNueva = "calcular ID Dir";
&amp;nbsp; dirNueva = "calcular direccion nombre";
&amp;nbsp; }
&amp;nbsp; if ( (featureSet.features&lt;K&gt;.attributes["TIPO_POSTE_CAMARA"] == "existente") &amp;amp;&amp;amp; (featureSet.features&lt;K&gt;.attributes["TIPO_DIRECCION"] == "existente") ) {&lt;/K&gt;&lt;/K&gt;
&amp;nbsp; rotNuevo = buscarRotulo(featureSet.features&lt;K&gt;.attributes["ID_POSTE_CAMARA"]);&lt;/K&gt;
&amp;nbsp; idDirNueva = featureSet.features&lt;K&gt;.attributes["ID_DIRECCION"];&lt;/K&gt;

&amp;nbsp; }

&amp;nbsp; var recordGraphic:Graphic = featureSet.features&lt;K&gt;;&lt;/K&gt;
&amp;nbsp; coleccionClientes.addItem({OBJECTID:recordGraphic.attributes["OBJECTID"], 
&amp;nbsp; NIS:recordGraphic.attributes["NIS"],
&amp;nbsp; NUMERO_MEDIDOR:recordGraphic.attributes["NUMERO_MEDIDOR"],
&amp;nbsp; TIPO_POSTE_CAMARA:recordGraphic.attributes["TIPO_POSTE_CAMARA"],
&amp;nbsp; ID_POSTE_CAMARA:String(idPosteNuevo),
&amp;nbsp; TIPO_DIRECCION:recordGraphic.attributes["TIPO_DIRECCION"],
&amp;nbsp; ID_DIRECCION:String(idDirNueva),
&amp;nbsp; ROTULO:String(rotNuevo),
&amp;nbsp; gra:recordGraphic});
&amp;nbsp; }

&amp;nbsp; }
&amp;nbsp; function onFaultQuery(info:Object, token:Object = null):void
&amp;nbsp; {&amp;nbsp;&amp;nbsp; 
&amp;nbsp; Alert.show("Error en consulta","Carga de Clientes");
&amp;nbsp; }
&amp;nbsp; }


&amp;nbsp; public function buscarRotulo(idp:String):String{
&amp;nbsp; var rt:String;
&amp;nbsp; var queryTask:QueryTask = new QueryTask(widgets.AdmIngresoClientes.utilidad.urls.URL_ROTULOS);
&amp;nbsp; var query:Query = new Query();
&amp;nbsp; query.where = "id_nodo="+ idp;
&amp;nbsp; query.outFields = ['rotulo'];
&amp;nbsp; query.returnGeometry = false;
&amp;nbsp; queryTask.execute(query, new AsyncResponder(onResultQuery2, onFaultQuery2));

&amp;nbsp; function onResultQuery2(featureSet2:FeatureSet, token:Object = null):void {

&amp;nbsp; //var recordGraphic:Graphic = featureSet2.features[index];
&amp;nbsp; rt = String(featureSet2.features[0].attributes["rotulo"]);
&amp;nbsp; // Alert.show(rotNuevo);
&amp;nbsp; }
&amp;nbsp; function onFaultQuery2(info:Object, token:Object = null):void
&amp;nbsp; {&amp;nbsp;&amp;nbsp; 


&amp;nbsp; }


&amp;nbsp; return rt;
&amp;nbsp; }


&amp;nbsp; protected function basewidget1_creationCompleteHandler(event:FlexEvent):void
&amp;nbsp; {
&amp;nbsp; // TODO Auto-generated method stub
&amp;nbsp; DataClientesNuevos.dataProvider = coleccionClientes;
&amp;nbsp; }

&amp;nbsp; ]]&amp;gt;
&amp;nbsp; &amp;lt;/fx:Script&amp;gt;
&amp;nbsp; &amp;lt;viewer:WidgetTemplate id="wTemplate"&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; width="800" height="500"
&amp;nbsp;&amp;nbsp;&amp;nbsp; visible="true"&amp;gt;

&amp;nbsp; &amp;lt;mx:Canvas id="ListadoClientes" label="Lista Clientes Nuevos" width="100%" height="100%"&amp;gt;
&amp;nbsp; &amp;lt;s:VGroup width="100%" top="5" bottom="5" height="100%"&amp;gt;
&amp;nbsp; &amp;lt;mx:Label id="Lblclie" text="Listado de Nuevos Clientes" fontSize="18"/&amp;gt;

&amp;nbsp; &amp;lt;mx:DataGrid id="DataClientesNuevos" resizableColumns="true" sortableColumns="true" editable="false"&amp;nbsp; 
&amp;nbsp; width="100%" height="100%" visible="true" selectable="true"&amp;gt;
&amp;nbsp; &amp;lt;mx:columns&amp;gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; &amp;lt;mx:DataGridColumn&amp;nbsp; dataField="OBJECTID" headerText="OBJECTID" width="30" visible="false"/&amp;gt;&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;&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;&amp;nbsp;&amp;nbsp; 

&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="NUMERO_MEDIDOR" headerText="NUMERO MEDIDOR" width="50" /&amp;gt;&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;&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;lt;mx:DataGridColumn dataField="NIS" headerText="NIS" width="50"/&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="TIPO_POSTE_CAMARA" headerText="TIPO_POSTE_CAMARA" visible="true" width="50" /&amp;gt;

&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="ID_POSTE_CAMARA" headerText="ID_POSTE_CAMARA" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="ROTULO" headerText="ROTULO" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="TIPO_DIRECCION" headerText="TIPO_DIRECCION" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="ID_DIRECCION" headerText="ID_DIRECCION" visible="true" width="50" /&amp;gt;


&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="DIRECCION_PROPIETARIO" headerText="DIRECCION PROPIETARIO" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="CALLE" headerText="CALLE" visible="true" width="50" /&amp;gt;
&amp;nbsp; &amp;lt;mx:DataGridColumn dataField="NUMERO" headerText="NUMERO" visible="true" width="50" /&amp;gt; 
&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;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp; &amp;lt;/mx:columns&amp;gt;
&amp;nbsp; &amp;lt;/mx:DataGrid&amp;gt;&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 

&amp;nbsp; &amp;lt;/s:VGroup&amp;gt;
&amp;nbsp; &amp;lt;/mx:Canvas&amp;gt;
&amp;nbsp; &amp;lt;/viewer:WidgetTemplate&amp;gt;
&amp;lt;/viewer:BaseWidget&amp;gt;&lt;/PRE&gt;&lt;P&gt;The logic is:&lt;/P&gt;&lt;P&gt;the main query that u get the "numero medidor, nis, tipo tipo_direccion is from a layer)&lt;/P&gt;&lt;P&gt;The "rotulo" is a query from another layer in the service, the result has to be in the coleccionClientes arrayList, where i ask for the id_poste and it gives me the result for the rotulo.&lt;/P&gt;&lt;P&gt;I have to do the same with the direccion&amp;nbsp; , calle , and numero.&lt;/P&gt;&lt;P&gt;Since im starting to get the rotulo, my problem is i get null for the 2 rows that it has to be shown. &lt;/P&gt;&lt;P&gt;The result is this one in the attach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i do this more efficiently? Cuz the async functions from the other layer im asking has a delay between each row.&lt;/P&gt;&lt;P&gt;thanks in advice! Soon i will start changing this to javascript T -T, i promise.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/getting-a-value-from-multiple-functions/m-p/32475#M775</guid>
      <dc:creator>EvelynHernandez</dc:creator>
      <dc:date>2021-12-10T21:17:13Z</dc:date>
    </item>
  </channel>
</rss>

