<?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 Layer not refreshing after 2nd update (flex 2.1 ags 9.3.1) in ArcGIS API for Flex Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521441#M11845</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have created a widget to change and view the statuses of barriers in a training area. I have a querytask that queries an mxd published as a service. My widget has a series of listboxes, the user drags barriers names from the first list into one of three different listboxes to represent the barrier statuses (day, night, varying times). Then they click update and a .net webservice performs an update on the sde database to change the statuses. i then run my querytask and display all the barriers on my map. the barriers are symbolised according to status using a uniquevaluerenderer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This all works brilliantly the first time I do it. however, if i then decide that i have set a few barriers to the wrong status and do another change, the barriers shown on the map do not change. The webservice is still updating correctly because the values in the database are correct. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am clearly missing something obvious. i have tried clearing the barriers layer before i run the query to display the barriers with their new statuses but it isn't working. Does anyone have any suggestions please?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 22 Dec 2010 14:16:25 GMT</pubDate>
    <dc:creator>grahamcooke</dc:creator>
    <dc:date>2010-12-22T14:16:25Z</dc:date>
    <item>
      <title>Layer not refreshing after 2nd update (flex 2.1 ags 9.3.1)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521441#M11845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have created a widget to change and view the statuses of barriers in a training area. I have a querytask that queries an mxd published as a service. My widget has a series of listboxes, the user drags barriers names from the first list into one of three different listboxes to represent the barrier statuses (day, night, varying times). Then they click update and a .net webservice performs an update on the sde database to change the statuses. i then run my querytask and display all the barriers on my map. the barriers are symbolised according to status using a uniquevaluerenderer. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This all works brilliantly the first time I do it. however, if i then decide that i have set a few barriers to the wrong status and do another change, the barriers shown on the map do not change. The webservice is still updating correctly because the values in the database are correct. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am clearly missing something obvious. i have tried clearing the barriers layer before i run the query to display the barriers with their new statuses but it isn't working. Does anyone have any suggestions please?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Dec 2010 14:16:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521441#M11845</guid>
      <dc:creator>grahamcooke</dc:creator>
      <dc:date>2010-12-22T14:16:25Z</dc:date>
    </item>
    <item>
      <title>Re: Layer not refreshing after 2nd update (flex 2.1 ags 9.3.1)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521442#M11846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Here's an extract of the relevant code if it helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;private function updateBarriers():void
{var listItems:ArrayCollection = new ArrayCollection(); 
//update the statuses as per the lists
if (lstDay.dataProvider.length &amp;gt; 0)
{listItems.source = lstDay.dataProvider.toArray();
updateBarrierStatuses("Day", listItems);}
if (lstNight.dataProvider.length &amp;gt; 0)
{listItems.source = lstNight.dataProvider.toArray();
updateBarrierStatuses("Night", listItems); }
if (lstVarying.dataProvider.length &amp;gt; 0)
{listItems.source = lstVarying.dataProvider.toArray();
updateBarrierStatuses("Varying", listItems);}
if (lstBarrierNames.dataProvider.length &amp;gt; 0)
{listItems.source = lstBarrierNames.dataProvider.toArray();
updateBarrierStatuses("Not Set", listItems);}
doShowAllBarriersQuery();
listItems = null;
}
private function updateBarrierStatuses(barrierType:String, items:ArrayCollection):void
{//create a variable to store the barrier name strings
var barrierNames:String = "";
var i:Number = 0;
//for the time being we are only working with 4 statuses. This means there is no need to determine id's at runtime
//if we need to implement different barrier statuses for different training areas and these need to be retrieved at run
//time then this will need to change!
var barrierStatus:Number;
switch (barrierType)
{case "Day":
{for(i = 0; i &amp;lt; items.length; i++)
{barrierNames = barrierNames + items&lt;I&gt;.toString() + ",";
barrierStatus = 1;} 
break;
}
case "Night":{
for(i = 0; i &amp;lt; items.length; i++)
{ barrierNames = barrierNames + items&lt;I&gt;.toString() + ",";
barrierStatus = 2;} 
break;}
case "Varying":{
for(i = 0; i &amp;lt; items.length; i++)
{ barrierNames = barrierNames + items&lt;I&gt;.toString() + ",";
barrierStatus = 3;} 
break;}
case "Not Set":{
for(i = 0; i &amp;lt; items.length; i++)
{ barrierNames = barrierNames + items&lt;I&gt;.toString() + ",";
barrierStatus = 4;} 
break;}
} //end switch
//remove the last "," from the list
barrierNames = barrierNames.substr(0, barrierNames.length - 1);
setBarrierStatusesWS(myTrainingAreaName, barrierNames, barrierStatus);}
private function setBarrierStatusesWS(trainingArea:String, barrierNames:String, status:Number):void
{myWS.updateBarrierStatus(trainingArea, barrierNames, status);}
private function doShowAllBarriersQuery() : void
{//empty the barrier layer first.
gfxBarriers.clear();
//set up a unique renderer to symbolise the barrier layer
// ref:http://resources.esri.com/help/9.3/arcgisserver/apis/flex/help/index.html#renderers.htm#
var uniqueValuerenderer:UniqueValueRenderer = new UniqueValueRenderer();
uniqueValuerenderer.attribute = "cawdapt_dev.CAWDAPT.Barriers.BARRIER_STATUS_ID";
var uniqueValueInfos:Array =[];
uniqueValueInfos.push(new UniqueValueInfo(daySymbol, "1"));
uniqueValueInfos.push(new UniqueValueInfo(nightSymbol, "2"));
uniqueValueInfos.push(new UniqueValueInfo(varySymbol, "3"));
uniqueValuerenderer.infos = uniqueValueInfos;
gfxBarriers.renderer = uniqueValuerenderer;
allBarriersQuery.where = " cawdapt_dev.CAWDAPT.Barriers.BARRIER_STATUS_ID &amp;lt;&amp;gt; 4";
queryTask.execute( allBarriersQuery, new AsyncResponder(onResult, onFault ));
function onGetBarrierResult( featureSet:FeatureSet, token : Object = null ) : void
{var displayFieldName : String = featureSet.displayFieldName;
for each ( var myGraphic : Graphic in featureSet.features )
{myGraphic.toolTip = "Barrier: " + myGraphic.attributes["cawdapt_dev.CAWDAPT.Barriers.BARRIER_NAME"] + "." ;
gfxBarriers.add( myGraphic );}
//zoom to full extent of map:
var graphicProvider:ArrayCollection = gfxBarriers.graphicProvider as ArrayCollection;
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(graphicProvider.toArray());}
function onGetBarrierFault( info : Object, token : Object = null ) : void
{Alert.show( info.toString() );}
}
&amp;lt;!--Web service results handling:--&amp;gt; 
&amp;lt;esri:QueryTask id="queryTask" url="http://lmgis02/ArcGIS/rest/services/Barriers/MapServer/0" useAMF="false"/&amp;gt;
&amp;lt;esri:Query id="allBarriersQuery" returnGeometry="true"&amp;gt;
&amp;lt;esri:outFields&amp;gt;
&amp;lt;fx:String&amp;gt;CAWDAPT_DEV.CAWDAPT.BARRIERS.BARRIER_NAME&amp;lt;/fx:String&amp;gt;
&amp;lt;fx:String&amp;gt;CAWDAPT_DEV.CAWDAPT.BARRIERS.BARRIER_STATUS_ID&amp;lt;/fx:String&amp;gt;
&amp;lt;fx:String&amp;gt;CAWDAPT_DEV.CAWDAPT.BARRIER_STATUSES.BARRIER_SYMBOL&amp;lt;/fx:String&amp;gt;
&amp;lt;fx:String&amp;gt;CAWDAPT_DEV.CAWDAPT.BARRIER_STATUSES.SYMBOL_COLOUR&amp;lt;/fx:String&amp;gt;
&amp;lt;/esri:outFields&amp;gt;
&amp;lt;/esri:Query&amp;gt;
&amp;lt;mx:TabNavigator width="100%" height="95%" x="0" y="0"&amp;gt;
&amp;lt;mx:Canvas label="Set Barriers" width="100%" height="100%" backgroundColor="#D8D8D8"&amp;gt;
&amp;lt;s:VGroup&amp;gt;
&amp;lt;mx:HRule width="100%" height="3"/&amp;gt;
&amp;lt;s:HGroup id="BarriersGroup"&amp;gt;
&amp;lt;s:VGroup&amp;gt;
&amp;lt;s:Label id="lblName" text="Barrier Name" toolTip="You can select multiple items by holding CTRL key and clicking, or select a block by holding shift key and clicking"/&amp;gt; 
&amp;lt;s:List id="lstBarrierNames" dragEnabled="true" dropEnabled="false" allowMultipleSelection="true" dragMoveEnabled="true" dataProvider="{barrierNameArray}" styleName="ListControl" skinClass="Landmarc.customSkins.BarrierListSkin" /&amp;gt;
&amp;lt;/s:VGroup&amp;gt;
&amp;lt;s:VGroup&amp;gt;
&amp;lt;s:Label id="lblDay" text="Day" toolTip="Drag and Drop Barriers open during the day into this column"/&amp;gt;
&amp;lt;s:List id="lstDay" dragEnabled="true" dropEnabled="true" allowMultipleSelection="true" dragMoveEnabled="true" dataProvider="{new ArrayCollection([])}" styleName="ListControl" skinClass="Landmarc.customSkins.BarrierListSkin"/&amp;gt;
&amp;lt;/s:VGroup&amp;gt;
&amp;lt;s:VGroup&amp;gt;
&amp;lt;s:Label id="lblNight" text="Night" toolTip="Drag and Drop Barriers open at night into this column"/&amp;gt;
&amp;lt;s:List id="lstNight" dragEnabled="true" dropEnabled="true" allowMultipleSelection="true" dragMoveEnabled="true" dataProvider="{new ArrayCollection([])}" styleName="ListControl" skinClass="Landmarc.customSkins.BarrierListSkin" /&amp;gt;
&amp;lt;/s:VGroup&amp;gt;
&amp;lt;s:VGroup&amp;gt;
&amp;lt;s:Label id="lblVary" text="Varying" toolTip="Drag and Drop Barriers open at varying times into this column"/&amp;gt;
&amp;lt;s:List id="lstVarying" dragEnabled="true" dropEnabled="true" allowMultipleSelection="true" dragMoveEnabled="true" dataProvider="{new ArrayCollection([])}" styleName="ListControl" skinClass="Landmarc.customSkins.BarrierListSkin"/&amp;gt;
&amp;lt;/s:VGroup&amp;gt;
&amp;lt;/s:HGroup&amp;gt;
&amp;lt;mx:HRule width="100%" height="3"/&amp;gt;
&amp;lt;s:Button label="Save barriers statuses" click="updateBarriers()"/&amp;gt;
&amp;lt;/s:VGroup&amp;gt;
&amp;lt;/mx:Canvas&amp;gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 22:44:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521442#M11846</guid>
      <dc:creator>grahamcooke</dc:creator>
      <dc:date>2021-12-11T22:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Layer not refreshing after 2nd update (flex 2.1 ags 9.3.1)</title>
      <link>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521443#M11847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Fixed this....knew it would be simple :mad:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For anyone who has the same issue, all you have to do is set disableclientcaching =true on the querytask!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 12:50:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-flex-questions/layer-not-refreshing-after-2nd-update-flex-2-1-ags/m-p/521443#M11847</guid>
      <dc:creator>grahamcooke</dc:creator>
      <dc:date>2010-12-23T12:50:54Z</dc:date>
    </item>
  </channel>
</rss>

