Looping through an arrayCollection

I need to:
1. loop through an array collection,
2. select a specific string from that collection
3. extract a url from that string
4. insert an additional string to the array with that extracted url
The code I am using so far is:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" minWidth="1024" minHeight="768">
    <mx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.rpc.events.ResultEvent;
            [Bindable]
            private var resultArrayCollection:ArrayCollection;
            private function doSearch (e:MouseEvent):void
                twitterSearch.url = "http://search.twitter.com/search.atom?q=LDN";
                twitterSearch.send();
            private function onResult (e:ResultEvent):void
                resultArrayCollection = e.result.feed.entry as ArrayCollection;
        ]]>
    </mx:Script>
    <mx:HTTPService id = "twitterSearch"
                    result="onResult(event)" />
the HTTP service pulls in data from Twitter search for example http://search.twitter.com/search.atom?q=LDN.
All help would be greatfully received.

Hi
I use this method to find objects in an ArrayCollection, you could probably modify accordingly.
public function findObjInArry(arryRef:ArrayCollection, objId:int):Object
         if(arryRef.length == 0)
             return null;
         for(var i:int=0; i<arryRef.length; i++)
             var arryObj:Obejct = arryRef.getItemAt(i) as Object;
             if(objId == arryObj.id)
                 return arryObj;
         return null;
Regarding adding items to ArrayCollection you can use the addItem methods.

Similar Messages

  • Looping through an array to get the index for each measure in a combo box

    Hi folks,
    I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I  have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards  can give me any tips on how to code this according to my code below ? Any  help is greatly appreciated! (the print scree is attached)
    Below is the code snippet:
    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
    fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
    var graphic:Graphic = Graphic(event.currentTarget);
    graphic.symbol = mouseOverSymbol;
    var htmlText:String = graphic.attributes.htmlText;
    var textArea:TextArea = new TextArea();
    try{
    textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
    myMap.infoWindow.content=textArea
    myMap.infoWindow.label = graphic.attributes.NAME;
    myMap.infoWindow.closeButtonVisible = false;
    myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
    catch(error:Error) {
    trace("Caught Error: "+error);
    And below is the combo boxes with the arrays
    <mx:FormItem label="Year        :"  >
    <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
    <mx:ArrayCollection id="year"  >
    <fx:Object label="2007"  year="2007" />
    <fx:Object label="2009"  year="2009" />
    </mx:ArrayCollection>
    </mx:ComboBox>
    </mx:FormItem>
    <mx:FormItem label="Measure:">
    <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
    <mx:ArrayCollection id="measures"   >
    <fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />
    <fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
    <fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
    <fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
    <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />
    <fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
    <fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
    <fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
    <fx:Object id="blank" label=" "  />
    </mx:ArrayCollection>

    And here is the entire code
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application       
                    xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:esri="http://www.esri.com/2008/ags"
                    paddingBottom="8" paddingLeft="8"
                    paddingRight="8" paddingTop="8"
                    backgroundColor="0xffffff"
                    layout="vertical" >
        <!-- Start Declarations -->
    <fx:Declarations>
            <esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
                <esri:SimpleLineSymbol width="0" color="#000000"/>
            </esri:SimpleFillSymbol>
            <esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0"   >
                <esri:SimpleLineSymbol width="1" color="#000000"/>
            </esri:SimpleFillSymbol>
        <!-- End Declarations -->
    </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import com.esri.ags.Graphic;
                import com.esri.ags.SpatialReference;
                import com.esri.ags.esri_internal;
                import com.esri.ags.events.GraphicEvent;
                import com.esri.ags.geometry.Extent;
                import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
                import com.esri.ags.symbols.SimpleFillSymbol;
                import com.esri.ags.symbols.SimpleLineSymbol;
                import flash.utils.flash_proxy;
                import mx.collections.ArrayCollection;
                import mx.controls.Alert;
                import mx.controls.RadioButton;
                import mx.controls.TextArea;
                import mx.events.DropdownEvent;
                import mx.events.ItemClickEvent;
                import mx.rpc.Fault;
                import mx.rpc.events.FaultEvent;
                import flash.display.Sprite;
                import flash.events.ErrorEvent;
                import flash.events.MouseEvent;
                private function closeHandler(evt:DropdownEvent):void {
                    myLabel.text = ComboBox(evt.target).selectedItem.labeltext;
                private function loadLayerName():void
                    myLegend.layers = null;
                    layerPanel.removeAllChildren();
                    //loop through each layer and add as a radiobutton
                    for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
                        var radioBtn:RadioButton = new RadioButton;
                        radioBtn.groupName = "radioBtnGroup";
                        radioBtn.value = i;
                        radioBtn.label = dynamicLayer.layerInfos[i].name;
                        if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
                            radioBtn.label = "Direct Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
                        {radioBtn.label = "Total Impact";
                        else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
                        {radioBtn.label = "Direct Impact";
                        else
                        {radioBtn.visible= false;
                        layerPanel.addChild(radioBtn);
                    /*     myDividerBox.getDividerAt(0).visible = false; */
                    //set the visible layer the first radio button
                     radioBtnGroup.selectedValue = 0;
                     dynamicLayer.visibleLayers = new ArrayCollection([0]);
                    myLegend.layers = [dynamicLayer];
                    myLegend.visible = true;
                private function radioClickHandler(event:ItemClickEvent):void
                    myLegend.layers = null;
                    // update the visible layers to only show the layer selected
                    dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
                    myLegend.layers = [dynamicLayer];
                private function changeEvt(event:Event):void {
                if (yearcombo.selectedItem.year == "2007")
                    measures.filterFunction=filter1
                    measures.refresh()
                    myURL.dataProvider=measures
                else if (yearcombo.selectedItem.year == "2009")
                    measures.filterFunction=filter2
                    measures.refresh();
            public function filter1(item:Object):Boolean
                if (item.year=="2007") return true
                else return false
                public function filter2(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEvt(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter3
                        measures.refresh()
                        myURL.dataProvider=measures
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter4
                        measures.refresh();
                public function filter3(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter4(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                private function clickEv2(event:Event):void {
                    if (yearcombo.selectedItem.year == "2007")
                        measures.filterFunction=filter5
                        measures.refresh()
                    else if (yearcombo.selectedItem.year == "2009")
                        measures.filterFunction=filter6
                        measures.refresh();
                    else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
                        myLegend.layers = null;
                        layerPanel.removeAllChildren();
                public function filter5(item:Object):Boolean
                    if (item.year=="2007") return true
                    else return false
                public function filter6(item:Object):Boolean
                    if (item.year=="2009") return true
                    else return false
                /* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
                if (myURL.selectedIndex==0)
                myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
                + "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
                public function fLayer_graphicAddHandler(event:GraphicEvent):void
                    event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
                    event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
                public function onMouseOverHandler(event:MouseEvent):void
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                        textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
                        myMap.infoWindow.content=textArea
                        myMap.infoWindow.label = graphic.attributes.NAME;
                        myMap.infoWindow.closeButtonVisible = false;
                        myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                    if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )
                        fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
                        var graphic:Graphic = Graphic(event.currentTarget);
                        graphic.symbol = mouseOverSymbol;
                        var htmlText:String = graphic.attributes.htmlText;
                        var textArea:TextArea = new TextArea();
                        try{
                            textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
                            myMap.infoWindow.content=textArea
                            myMap.infoWindow.label = graphic.attributes.NAME;
                            myMap.infoWindow.closeButtonVisible = false;
                            myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
                        catch(error:Error) {
                            trace("Caught Error: "+error);
                public function onMouseOutHandler(event:MouseEvent):void
                    var gr:Graphic = Graphic(event.target);
                    gr.symbol = defaultsym;
                    myMap.infoWindow.hide();
            ]]>
        </fx:Script>
        <fx:Style>
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace s "library://ns.adobe.com/flex/spark";
            @namespace mx "library://ns.adobe.com/flex/mx";
            @namespace esri "http://www.esri.com/2008/ags";
            @namespace components "com.esri.ags.components.*";
            components|InfoWindow
                content-background-alpha : 0.4;
                background-color : #4A7138;
                background-alpha : 0.7;
                border-style : solid;
        </fx:Style>
        <mx:HBox   width="930" height="800"  id="mapHbox"  horizontalAlign="center" >   
        <mx:HBox width="80">
        </mx:HBox>
        <mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff"  >
            <mx:VBox  height="590" width="358"  >
            <!--    <mx:Panel
                    width="356" height="100%"
                    color="0x000000"
                    borderAlpha="0.15"
                    >
                    -->
                    <mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
                        <esri:Map id="myMap" openHandCursorVisible="false"
                                  height="100%" 
                                  logoVisible="false"
                                  doubleClickZoomEnabled="false"
                                  scrollWheelZoomEnabled="false"
                                  zoomSliderVisible="false"
                                  scaleBarVisible="false" scale="4000000" >
                            <esri:extent>
                                <esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100"      >
                                    <esri:SpatialReference wkid="102100"/>
                                </esri:Extent>
                            </esri:extent>
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
                                                               url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
                            <esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
                                                               alpha="1"
                                                               load="loadLayerName()"
                                                       url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer"   />
                            <esri:FeatureLayer id="fLayer"
                                               graphicAdd="fLayer_graphicAddHandler(event)"
                                               mode="snapshot"
                                               outFields="*"
                                               symbol="{defaultsym}"
                                               url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
                        </esri:Map>
                    </mx:Canvas>
            <!--    </mx:Panel>-->
            </mx:VBox>       
            <mx:VBox  height="590" width="20"  >
            </mx:VBox>       
            <mx:Canvas height="500" width="400" backgroundColor="0xffffff"
                       horizontalScrollPolicy="off"
                       verticalScrollPolicy="off" >
                <mx:VBox  width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
                         verticalGap="8">
                    <mx:Form  >
                        <mx:FormItem label="Year        :"  >
                            <mx:ComboBox   id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)"  >
                                <mx:ArrayCollection id="year"  >
                                    <fx:Object label="2007"  year="2007" />
                                    <fx:Object label="2009"  year="2009" />
                                </mx:ArrayCollection>
                            </mx:ComboBox>
                        </mx:FormItem>
                        <mx:FormItem label="Measure:">
                            <mx:ComboBox   id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
                            <mx:ArrayCollection id="measures"   >
                                <fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007"  />
                                <fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
                                <fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
                                <fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
                                <fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009"  />
                                <fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
                                <fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
                                <fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
                                <fx:Object id="blank" label=" "  />
                            </mx:ArrayCollection>
                        </mx:ComboBox>
                        </mx:FormItem>
                    </mx:Form>
                    <mx:VBox  id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
                        <mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)"  />
                    </mx:VBox>
                    <mx:VBox paddingLeft="17" height="50%" >
                    <mx:Canvas  id="legendPanel" width="100%"  >
                        <mx:Label id="myLabel" text=" " fontWeight="bold" />
                        <esri:Legend id="myLegend"
                                     layers="{[dynamicLayer]}"
                                     map="{myMap}" visible="false"
                                     respectCurrentMapScale="false"/>
                    </mx:Canvas>
                    <mx:TextArea width="275"  borderAlpha="0" height="200"  >
                        <mx:htmlText   >
                            <![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
                            ]]>
                        </mx:htmlText>
                    </mx:TextArea>
                    </mx:VBox>   
                </mx:VBox>
            </mx:Canvas>
        </mx:HBox>
        </mx:HBox>   
    </mx:Application>

  • Tree control loop through nodes

    Hi All,
    I have a tree control. I want to loop through the nodes and
    add all the nodes to an array collection.
    How do I do it?
    Thanks in advance;
    Josh

    It depends on the data type of the dataProvider.
    If XML, then myXML.descendants(); will return an xmlList of
    all nodes. You could loop over the XMLList and build an
    ArrayCollection
    If the dataProvider is a collection, then you will need a
    recursive function to process the dataProvider.
    Tracy

  • Nested Loops...looping through one month of data at a time year by year

    Hi all,
    I'm trying to create an insert statement that loops through a table that has 10 years of data (2001 to 2010) month by month to minimize impact on server and commits more frequently to avoid filling up the redo logs and rollback tablespaces. The table is large, has about 40 millions records per year. Lets say the structure of the table is the following:
    Customer_ID number(9),
    Order_Item_1 number(6),
    Order_Item_2 number(6),
    Order_Item_3 number(6),
    Order_date date
    The table is in flat format but I want to normalize it so that it looks like the following:
    Customer_ID Order_Seq Order_Item Order_date
    999999999 1 555555 01-jan-2001
    999999999 2 666666 01-jan-2001
    999999999 3 444444 01-jan-2001
    888888888 1 555555 03-jan-2001
    888888888 2 666666 03-jan-2001
    But because I want to loop through month by month....I need to set it up so that it loops through month by month, year by year (Using the Order Date Field) and Order_item by Order_item. Something like:
    so my insert statements would be something like if I hardcoded instead of put the insert statement into a loop:
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,1,Order_item,Order_date where Order_item_1 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,2,Order_item,Order_date where Order_item_2 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,3,Order_item,Order_date where Order_item_3 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='01';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,1,Order_item,Order_date where Order_item_1 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='02';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,2,Order_item,Order_date where Order_item_2 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='02';
    insert into orders_normalized
    (Customer_id,Order_seq,Order_item,Order_date) select customer_id,3,Order_item,Order_date where Order_item_3 is not null and to_char(order_date,'yyyy') = '2001' and to_char(order_date,'mm')='03';
    Hope this makes sense.
    Thanks

    Does the sequence of items in an order really matter? In other words, do we really need to preserve that an item was in position 2 versus position 1? I bet that the sequence or position of each item in an order is not meaningful. They were probably numbered 1, 2, and 3 just to make them uniquely named columns so there would be three slots to hold up to 3 items in the denormalized table.
    You only have about 400 million rows to insert, so it could feasibly be done in a single transaction (depending on your database environment).
    You can always do a create table as select (CTAS) to help with undo / redo issues and get better performance. You could run it in parallel, and spit it out to a new table partitioned by month. Single DDL statement running in parallel making your new table--sounds good to me.
    How about something like this:
    CREATE TABLE ORDERS_NORMALIZED
    (CUSTOMER_ID, ORDER_ITEM, ORDER_DATE)
    PARTITION BY RANGE(ORDER_DATE)
    PARTITION p200901 VALUES LESS THAN (TO_DATE('200902','YYYYMM')),
    PARTITION p200902 VALUES LESS THAN (TO_DATE('200903','YYYYMM')),
    PARTITION p201012 VALUES LESS THAN (TO_DATE('201101','YYYYMM'))
    as SELECT CUSTOMER_ID, ORDER_ITEM_1, ORDER_DATE
       FROM OTHER_TABLE
       WHERE ORDER_ITEM_1 IS NOT NULL
       UNION ALL
       SELECT CUSTOMER_ID, ORDER_ITEM_2, ORDER_DATE
       FROM OTHER_TABLE
       WHERE ORDER_ITEM_2 IS NOT NULL
       UNION ALL
       SELECT CUSTOMER_ID, ORDER_ITEM_3, ORDER_DATE
       FROM OTHER_TABLE
       WHERE ORDER_ITEM_3 IS NOT NULL.....................
    Out of curiosity, why not normalize it further? You could have used two tables instead of one.
    One (ORDER) with:
    ORDER_ID
    CUSTOMER_ID
    DATE
    Order_id would be a new surrogate key / primary key.
    Another table (ORDER_ITEM) with:
    ORDER_ID
    ORDER_ITEM
    It would be a table that links ORDERS to ITEMS. You get the idea.

  • Text is not being displayed in sync on a label when looping through a list -- how to fix?

    I have a list of states (50 states).  I loop through this list (in a winform app -- VS2012) and want to display the current state ID that is being processed in the loop in the text property of a label.  I precede the label.Text = StateID line with
    Application.DoEvents() but I am also (in Debug mode) writing the same text to the console.  The console displays correctly, but there appears to be a lag in the label.Text property
    List<string> StateList = new List<string> { "al", "ak", "az","ar","ca","co","ct","de","fl","ga",...};
    foreach (string stateID in StateList)
        Application.DoEvents();
        lblStateID.Text = "State is " + stateID;  //--there is a lag here
    I vaguely recollect something about a NotifyPropertyChanged event.  I know this is common in WPF, but is there something similar in winform?  Or is there a way to make the desired text to be displayed in the label.Text property in synchronization
    with the loop?
    Rich P

    Thank you.  This is way simpler than implementing the INotifyPropertyChanged Interface.  Although, here is an article on the INotifyPropertyChanged Interface and event
    http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged(v=vs.110).aspx
    Rich P

  • Automator - Loop through a text file and process data through a 3rd party software

    Just stumbled on Automator the other day (I am a mac n00b) and would like to automate the processing of a text file, line-by-line, using a third party tool.  I would like Automator to loop through the text file one line at a time, copy the string and keep as a variable.  Next, place the variable data (copied string) into the text field of the 3rd party software for processing.  Once the processing is complete, I would like Automator to fetch the next line/string for processing.  I see items like "copy from clipboard" and  "variables" within the menu but I am not finding much documentation on how to utilizle this tool.  Just hear how potentially powerful it is. 
    The 3rd party software is not a brand name, just something made for me to process text.  I may have to use mouse clicks or tabs + [return] to navigate with Automator.  A term I heard on Bn Walldie's itunes video series was "scriptable software" for which I don't think this 3rd party app would be. 
    Kind regards,
    jw

    Good news and bad news...
    The good news is that it should be entirely possible to automate your workflow.
    The bad news is that it will be a nightmare to implement via Automator, if it's even possible.
    Automator is, essentially a pretty interface on top of AppleScript/Apple Events, and with the pretty interface comes a certain stranglehold on features. Knowing how to boil rice might make you a cook, but understanding flavor profiles and ingredient combinations can make you a chef, and it's the same with AppleScript and Automator. Automator's good at getting you from points A to B but if there are any bumps in the road (e.g. the application you're using isn't scriptable) then it falls apart.
    What I'm getting at is that your requirements are pretty simple to implement in AppleScript because you can get 'under the hood' and do exactly what you want, as opposed to Automator's restricted interface.
    The tricky part is that if no one else can see this app it's going to be hard to tell you what to do.
    I can give you the basics on reading a file and iterating through the lines of text in it, and I can show you how to 'type' text in any given application, but it may be up to you to put the pieces together.
    Here's one way of reading a file and working through each line of text:
    -- ask the user for a file:
    set theFile to (choose file)
    -- read the file contents:
    set theFileContents to (read file theFile)
    -- break out the lines/paragraphs of text:
    set theLines to paragraphs of theFileContents
    -- now iterate through those lines, one by one:
    repeat with eachLine in theLines
      -- code to perform for eachLine goes here
    end repeat
    Once you have a line of text (eachLine in the above example) you can 'type' that into another application via something like:
    tell application "AppName" to activate
    tell application "System Events"
              tell process "AppName"
      keystroke eachLine
              end tell
    end tell
    Here the AppleScript is activating the application and using System Events to emulate typing the contents of the eachLine variable into the process. Put this inside your repeat loop and you're almost there.

  • Forms 6i loop through datablock question

    I am writing a piece of code to loop through items with in a datablock to programmatically set the width between each field.
    I created my data block through the wizard, but then manually added some fields. I have them listed in the order I expect them to be navigated, which is the order I expect them to appear on the screen.
    When I am looping through the data block, I was assuming that next_item would go to the next navigable item, and it doesn't.
    For example, I have items received_today, worked_today, total_waiting, total_for_today, total_calls, total_priority.
    When the code loops through the data block, it actually loops in this order: received_today, worked_today, total_callbacks, total_priority, total_waiting, total_for_today.
    I even set the next navigation item property for each item, but that didn't help.
    My questions:
    1. Is there a way to control what order the data block loops through items?
    2. Why does this line get_item_property(get_block_property(block_name, FIRST_ITEM), x_pos); sometimes return null? (in my "proof of concept" form it returns a value, but the form I am modifying does not)
    Following is my code:
    PROCEDURE set_x_y_positions IS
         current_x_position pls_integer;
         current_y_position pls_integer;
      block_name varchar2(30) := 'BLOCK22';
      CurrentItem varchar2(30);
    BEGIN
      go_block(block_name);
      current_x_position := get_item_property(get_block_property(block_name, FIRST_ITEM), x_pos);
      current_y_position := get_item_property(get_block_property(block_name, FIRST_ITEM), y_pos);
          go_block(block_name);
      loop
           BEGIN
                if :system.cursor_item <> (block_name || '.' || get_block_property(block_name, FIRST_ITEM))
                     and get_item_property(:system.current_item, displayed) = 'TRUE' then            
                  SET_ITEM_PROPERTY(:system.current_item, x_pos, current_x_position + 38);
                  current_x_position := get_item_property(:system.current_item, x_pos);
                end if;
                if :system.cursor_item = 'BLOCK22.INTERNATIONAL' THEN--block_name || '.' || get_block_property(block_name, LAST_ITEM) then
                          exit;
                else
                     next_item;
                end if;
           END;
      end loop;
    END;I am using Forms 6i version 6.0.8.26.0
    Thank you!
    Katia

    I do have an exit, and yes it does run well.
         if :system.cursor_item = 'ATS_MON_REPORTING_QUEUES_VW.INTERNATIONAL' THEN--block_name || '.' || get_block_property(block_name, LAST_ITEM) then
                          exit;
                else
                     next_item;
                end if;That redundant go_block is there because I had some output going to a dummy field in another block, so I had to make sure it was navigating back to the block. But yes, in this code example, that go_block is redundant.
    Thank you, adding the
    current_x_position := get_item_property(block_name||'.'|| get_block_property(block_name, FIRST_ITEM), x_pos);
      current_y_position := get_item_property(block_name||'.'|| get_block_property(block_name, FIRST_ITEM), y_pos); worked perfectly.

  • How to loop through the "On My Mac" folders in mail?

    Hi there - i am new to applescript, but am slowly working out how to use it.
    I am stumped on how to write a rule that will move a message to a folder identified by a tag in a message (I am using MailTags).
    I have script that will take the first tag and move the message to a mail folder in a fixed location (e.g. Archive/<tag name>) however I wanted to make it more generic by looping over all of my mail folders and finding one that matched the tag name.
    However I am stumped on how to loop over all of my mail folder names - I have tried:
    repeat with aFolder in (every mailbox of (mailbox for "ON MY MAC"))
    and
    repeat with aFolder in every mailbox of inbox
    etc.
    but none of these seem to work.
    Is there some magic syntax to do this, so that I can do:
    if (name of aFolder = msgTag) then
    move oneMessage to mailbox (name of aFolder)
    end if
    Tim

    You don't necessarily need to assign a variable to the entire list in order to loop through them (unless you really want to) - for example:
    tell application "Mail" to repeat with aFolder in (get mailboxes)
            -- do stuff with aFolder
    end repeat
    There are several AppleScript resources, but the main ones I use are:
    AppleScript Language Guide
    AppleScript Tutorials at MacScripter.net

  • How do I loop through tables, not columns in a table?

    Sorry if this is a long one. My problem is actually quite simple. I am trying to write either an ad hoc PL/SQL block or a stored procedure to loop 18 times (thru 18 tables) and perform a SQL query on those tables, returning 18 resultsets. I would like the results to show up on the screen (or in a spool file, whatever).
    So far I have tried 3 different approaches, none of which have worked.
    1. I tried to assign the select query to a variable (qry) and use EXECUTE IMMEDIATE qry. This forced me thru a variety of errors to declare variables and assign the result to them--EXECUTE IMMEDIATE qry into nm0, nm1, nm2...
    The problem with that was the resultset returned more than the variable was built for as there might be no rows returned, or it might be a thousand rows of data. So I tried changing the variables to VARRAYS, but it gave me a type mismatch as the underlying columns were NUMBER and VARCHAR2.
    DECLARE
         ctr number;
         TYPE NUMLIST IS VARRAY (1000) OF NUMBER;
         TYPE VARLIST IS VARRAY (1000) OF VARCHAR2(15);
         nm0 NUMLIST NOT NULL DEFAULT 1;
         nm1 VARLIST;
         nm2 NUMLIST NOT NULL DEFAULT 1;
         nm3 VARLIST;
         nm17 NUMLIST NOT NULL DEFAULT 1;
         qry VARCHAR2(2000) := 'klx_uln_p000_cells';
    BEGIN
    FOR ctr IN 1..17 LOOP
         IF ctr &lt; 10 THEN
              qry := 'SELECT
              A.DIM_0_INDEX,
              S0.SYM_NAME,
              A.DIM_1_INDEX,
              S1.SYM_NAME,
              A.DIM_2_INDEX,
              S2.SYM_NAME,
              A.DIM_3_INDEX,
              S3.SYM_NAME,
              A.NUMERIC_VALUE,
              B.NUMERIC_VALUE
              FROM
              KHALIX.klx_uln_p00'||ctr||'_cells A,
              KHALIX.klx_ucn_p00'||ctr||'_cells B,
              KHALIX.KLX_MASTER_SYMBOL S0,
              KHALIX.KLX_MASTER_SYMBOL S1,
              KHALIX.KLX_MASTER_SYMBOL S7
              WHERE
              A.DIM_0_INDEX=B.DIM_0_INDEX AND
              A.DIM_1_INDEX=B.DIM_1_INDEX AND...
              A.DIM_7_INDEX=S7.SYM_INDEX';
         ELSE
              qry := 'SELECT
              A.DIM_0_INDEX...
              A.DIM_7_INDEX=S7.SYM_INDEX';
         END IF;
         BEGIN
         dbms_output.put_line('SELECT FOR KLX_ULN_P00'||ctr||'_CELLS');
         dbms_output.put_line(nm16);
         dbms_output.put_line(nm17);
         EXECUTE IMMEDIATE qry into nm0,nm1,nm2,nm3,nm4,nm5,nm6,nm7,nm8,nm9,nm10,nm11,nm12,nm13,nm14,nm15,nm16,nm17;
    --     dbms_output.put_line(qry);
         dbms_output.put_line(nm16);
         dbms_output.put_line(nm17);
         EXCEPTION
              WHEN NO_DATA_FOUND THEN
                   dbms_output.put_line('No data found for Query '||ctr);
         END;
    END LOOP;
    EXCEPTION
         WHEN NO_DATA_FOUND THEN
              dbms_output.put_line('No data found for Query '||ctr);
    END;
    2. So then I used REF CURSOR to create a stored procedure and return the values. That allowed me to run my query AND tokenize the tablenames with a counter so that it would loop through the different tables! However, I still could not get it to display the results without going to SQL Plus and typing 'print c;'.
    3. So, finally I tried to create a looping wrapper around the ref cursor to have some variable (ctr) increment so my query would get performed on table0_cells through table17_cells. This, too, did not work.
    If I manually go to SQL Plus and type:
    variable ctr number
    begin
    :ctr := 1;
    end;
    exec dupe_find(1,:c);
    it will execute for the first table (klx_uln_p001_cells) and I can then type 'print c' to see what was returned. But when I try putting this within a wrapper PL/SQL block with a Loop to make ctr go from 0 - 17 (to loop through table_names klx_uln_p000_cells to klx_uln_p017_cells), it does not work.
    Help! It should be very simple to loop through tables, shouldn't it? I just want a script that will loop through tables, perform a query on each table and display the results. For some reason, I can only find documentation examples on looping through columns that are all in the same table.
    Dave

    Here's a working example using your first strategy ...
    create table t1 (id number);
    create table t2 (id number);
    insert into t1 values (100);
    insert into t1 values (101);
    insert into t2 values (200);
    insert into t2 values (201);
    declare
    v_table_name user_tables.table_name%type;
    type ttab_id is table of t1.id%type index by binary_integer;
    tab_id ttab_id;
    begin
    for i in 1 .. 2 loop
    v_table_name := 't' || i;
    execute immediate 'select id from ' || v_table_name
    bulk collect into tab_id;
    dbms_output.put_line('query from ' || v_table_name);
    for j in 1 .. tab_id.count loop
    dbms_output.put_line(tab_id(j));
    end loop;
    end loop;
    end;
    There are many other ways to do this (especially if you need to do more than just print out the data).
    Richard

  • Looping through inbox items on timer event is really slow...?

    Hi,
    I have an issue with a email sync event that I am running.  Essentially, I am given a date (the received date of the last email synced) via another process and then need to return all the emails in the user's inbox the where receivedDate > this given
    date.
    I have a timer object than triggers my sync event every 15 mins.  I also have a button that allows the user to manually activate the sync - this basically changes the timer to 3 secs and so it fires the sync event.
    If the sync event is fired manually as per above, it loops through everything quite quickly (~12,000 emails in 30 secs) and I can stored the sender/recipient and received time data I require from these in a list of objects, which I sync later on in a background
    process.  During this loop the main UI freezes up, which is fine since I show a progress bar so the user knows how long they need to wait, and a large sync like this should only occur on their first sync theoretically.  If the first sync event is
    fired without the manual input - so still called from the same timer event, but just on the normal 15 min event, not the shortened 3 sec one - then it runs differently.  The sync takes a lot lot longer, and the UI doesn't freeze up.
    I presume this might be because it is fired slightly differently and does not hog up the main thread, but rather shares it with normal Outlook operations.  Maybe the operations are being run on a background thread and then keep having to jump into the
    main thread to access the email items...?  Either way, I'm not quite sure how this is happening since the only difference is the user pressing a button that changes the timer.interval.  The code that is run is the same, and the button press doesn't
    trigger the actual sync itself.
    Is there a way I can force this first sync to always run solely in the main thread, it can freeze up Outlook and show the progress bar until it is done?  Ideally any subsequent syncs would then be run with no progress bar and no freezing up of the UI.
    Many thanks,
    Tom

    Hello Tom,
    > Maybe the operations are being run on a background thread and then keep having to jump into the main thread to access the email items...?
    You shouldn't use another threads when dealing with the Outlook object model. Office applications use the single threaded apartment (STA) model and don't support multithreading. All calls made from another threads are marshalled by Outlook to the main
    thread. However, you can use a low-level code (Extended MAPI) to access the data from secondary threads. For example, you can use Redemption which is based on Extended MAPI.
    >  it loops through everything quite quickly (~12,000 emails in 30 secs)
    Instead of looping over all items in the folder I'd recommend using the
    Find/FindNext
    or
    Restrict methods of the Items class. You can read more about them in the following articles:
    How To: Use Find and FindNext methods to retrieve Outlook mail items from a folder (C#, VB.NET)
    How To: Use Restrict method to retrieve Outlook mail items from a folder
    You can use the System.Windows.Forms.Timer class which uses the main thread for invoking the Tick event. The .NET
    Framework Class Library provides three different timer classes: System.Windows.Forms.Timer, System.Timers.Timer, and System.Threading.Timer. Each of these classes has been designed and optimized for use in different situations. The Comparing
    the Timer Classes in the .NET Framework Class Library article examines the three timer classes and helps you gain an understanding of how and when each class should be used.
    Also you may find the
    AdvancedSearch method of the Application class helpful. Pay special attention to the fact that the search is performed in another thread. You don’t need to run another thread manually since the
    AdvancedSearch method runs it automatically in the background. See
    Advanced search in Outlook programmatically: C#, VB.NET for more information.

  • Looping through each record

    Hi everyone
              I am new in crystal reporting and using Crystal Reports XI release 2. Firstly I should explain what I need to have. In my database I have got a parent table called Initiatives and a child table called benefits. One initiative has got many benefits associated with it and benefits are updated regularly by the users. Now my manager wants me to create an Initiative reports in such a way that all the initiatives are displayed and against each initiative there should be a box filled with either of these colour (red, yellow, green).
    Let's say if Initiative "X" has got 10 benefits and if one or more benefits are outstanding by more than 2% then the colour of the box should be red. And if no benefit is outstanding by more than 2% and one or more benefits are outstanding more then 1% and less then 2% then colour of box should be yellow. And if no benefit is outstanding more than 1% then colour of box should be green.
    Now for this I have created a report displaying all initiatives and a sub report with a SQL command containing the data from the benefits table. I have also included a database field which I would use as a box.
    Now I want to loop through each record of the crystal report till the last record and format the field as per condition. I would probably use nested loop to look for the status of the benefits but I don't know how to do this in CR. In short I am looking to do this thing in CR
    While Recordset.EOF
    Do
    But I can't find a key word for EOF or count-1 or some thing like that.
    Seeking the help of you guys.
    Regards,

    It would be much easier to simply let Crystal's conditional formatting do this for you.
    Almost every formatting aspect of each object in Crystal can be controlled via expressions.  Just click on the expression button to the right of the property...
    ido

  • Looping through SQL statements in shell script

    Hello members,
    I'm working on the Solaris environment and the DB i'm using is Oracle 10g. Skeleton of what I'm attempting;
    Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a jist of what I'm attempting, below.
    1. Copy file to be processed (one file at a time, from a list of 10 files in the folder ).
    for i in *
               do
               cp $i /home/temp[/CODE]2 . Create a snapshot(n) table : Initialize n = 1 -- -- To create my snapshot table and inserts records in SQL
    create table test insert account_no, balance from records_all;3. Checking if the table has been created successfully:
    select count(*) from snapshot1 -- query out the number of records in the table -- always fixed, say at 400000
    if( select count(*) from snapshot(n) = 400000 )
    echo " table creation successful.. proceed to the next step "
    else
    echo " problem creating table, exiting the script .. "  4. If table creation is successful,
    echo " select max(value) from results_all " -- printing the max value to console
    5. Process my files using the following jobs:
    ./runscript.ksh - READ -i $m ( m - initial value 001 )
    ./runscript.ksh - WRITE -i $m ( m - initial value 001 -- same as READ process_id )
    -- increment m by 1
    6. Wait for success log
    tail -f log($m)* | -egrep "^SUCCESS"7. looping to step1 to :
    Copy file 2 to temp folder;
    create snapshot(n+1) table
    Exit when all the files have been copied for processing.
    done -- End of Step 1
    Pointers on getting me moving will be very valuable.
    thanks,
    Kris

    Hi,
    Are you inserting the data from file or from some table.
    If it is from file, I suggest sql loader would be better, I suppose.
    If it is from table, then something like this
    for i in *
               do
    sqlplus username/password@db_name<<EOF
                create table test select * account_no, balance from records_all;
    EOF
    exit
    doneAnurag

  • Looping through nested datasets

    My apologies in advance if this has been asked before, but the search function on these forums doesn't appear to be working at the moment...
    Using: Spry 1.6.1
    Dreamweaver CS5
    IE 7 and 8, Firefox 4, and Chrome 10
    The question:
    I have a parent xml dataset, with two nested datasets, like this:
         var dsCourse = new Spry.Data.XMLDataSet("menu2.xml", "menu");
         var dsTopic = new Spry.Data.NestedXMLDataSet(dsCourse, "topic");
         var dsLessons = new Spry.Data.NestedXMLDataSet(dsTopic, "lesson");
    The data displays properly in the html, using regions, etc. However, when I try looping through them using javascript:
         topics = dsTopic.getData();
         for (var t = 0; t < topics.length; t++) { //loop through the topics dataset
              dsTopic.setCurrentRowNumber(t);
              var top = dsTopic.getCurrentRow();
              alert('current topic row name: ' + top["@name"]); //for debug purposes, display the topic name
              var rows = dsLessons.getData();
              for (var i = 0; i < rows.length; i++) { //loop through the lessons dataset
                        dsLessons.setCurrentRowNumber(i);
                        alert("lesson name is: " + rows[i]['name']);//display the lesson name
    It will perform both loops properly, displaying the correct information for each dataset in Firefox 4, but in IE 7 and 8, and in Chrome it will list each of the Topics correctly, but only displays the first set of lessons.
    The xml looks like:
    <topic name="Claims" default="true" complete="false">
            <lesson>
                <name>Getting Started</name>
                <score>0</score>
           </lesson>
            <lesson>
                 <name>Adding a Claim</name>
                 <score>0</score>
                 </lesson>
            <lesson>
                 <name>Adding a Claimant</name>
                <score>0</score>
            </lesson>
    <topic name="Bills" default="false" complete="false">
             <lesson>
                   <name>Bill Components</name>
                    <score>0</score>
              </lesson>
    etc.
    For what it's worth, all of the topics and lessons display properly in the html using spry regions, etc. It only appears to have an issue in javascript. And then only in IE. Is there, perhaps, a better way to do this that I'm not aware of?
    Thanks in advance!
    Jonathan

    This might help http://labs.adobe.com/technologies/spry/samples/data_region/NestedXMLDataSample.html
    Gramps

  • BRF : Looping through a table (e.g. Do Until or While, etc..)

    Hello Colleagues,
    In BRFPLus I understand we can create Loop Expressions that allow you to loop through a table and perform different Actions based  on the retrieved contents of the table.
    We are not using BRFPLus (but the old BRF instead). Does anyone know how to build Loop Expressions in BRF without the use of ABAP Function Modules?
    Your feedback would be really appreciated.
    Thanks in advance.
    Regards,
    Ivor M.

    Hello Colleagues,
    In BRFPLus I understand we can create Loop Expressions that allow you to loop through a table and perform different Actions based  on the retrieved contents of the table.
    We are not using BRFPLus (but the old BRF instead). Does anyone know how to build Loop Expressions in BRF without the use of ABAP Function Modules?
    Your feedback would be really appreciated.
    Thanks in advance.
    Regards,
    Ivor M.

  • Looping through a table

    how do I loop through the following table and get it to insert records into another depending on the number that it finds in the value column. eg if there is 8 in the value column, 8 records should be inserted into another table with the same ID
    i forgot to paste an example table
    ID
    Name
    Value
    1
    john
    12
    2
    sarah
    20
    3
    Tom
    5
    I want it to look at the value column and if it is 12 it should add 12 rows with the same ID into another table. eg in the new table there will be 12 rows for John with an ID of 1. For Sarah there will be 20 rows with an ID of 2.
    sukai

    Sure!
    DECLARE @sourceTable TABLE (ID INT, Name VARCHAR(20), Value INT)
    INSERT INTO @sourceTable (ID, Name, Value) VALUES (1, 'john', 12),(2, 'sarah', 20),(3, 'Tom', 5)
    This mocks up your source table (where your data is coming from). We're simply creating a table variable, and populating it with your example data.
    DECLARE @numbers TABLE (value INT)
    WHILE (SELECT COUNT(*) FROM @numbers) < (SELECT MAX(Value) FROM @sourceTable)
    BEGIN
    INSERT INTO @numbers (value) VALUES ((SELECT COUNT(*) FROM @numbers)+1)
    END
    This creates an example numbers table. The while causes the code to loop until there are as many rows as the maximum value for the Value column in your example data. Each time the loop iterates it inserts a row, causing the COUNT(*) to be one more each time,
    we add one to that, and insert it into the numbers table.
    INSERT INTO destinationTable
    SELECT s.ID, s.Name, s.Value
    FROM @sourceTable s
    INNER JOIN @numbers n
    ON s.Value >= n.value
    ORDER BY s.ID
    This performs an insert select to a made up table. We join the rows from @sourceTable (your example data) to the @numbers table where the Value column from @sourceTable is less than or equal to the value column in the numbers table. If s.Value is 1
    we'll perform this join once. If it's 2, twice and so on. This works because of the way we set up the numbers table. If we had insert multiple 1's it would cause additional joins.
    A numbers table is a handy tool to have for things like this were you need iterations. Create a database (or schema) on your database and call it something like 'Toolbox'. In that database/schema you can put things like this that have little to do with your
    actual data, but come in handy. You can make your numbers table as long as you need. It totally wouldn't hurt at all to have a numbers table with hundreds of thousands of rows. They're just int's, they don't eat much :).
    Let me know if you'd like anything clarified more.

Maybe you are looking for

  • Problem while dropping a table

    Dear All, I am facing a problem while dropping a table in Oracle 10g. I am able to find the number of records in the table but unble to delete it. SQL> select count(*) from merchant_audit; COUNT(*) 30028278 SQL> drop table merchant_audit; drop table

  • Can i connect a windows pc to my mac via ethernet and connect the pc to the internet?

    I have a windows pc in my office which needs internet connection to verify some of the software i use, i do not have a wired connection in the room. can i connect the pc to my mac and connect the pc to the internet via the macs wireless connection? i

  • INPATH problem: doesnt work as expected?

    Hi everyone, i need your help on something i ran into yesterday. Consider the following XML that is the content of XMLType field in our novels db: <record> <leader>01127nam 2200385 a 4500</leader> <controlfield tag="001">0000795331</controlfield> <co

  • Camera to computer

    I am trying to download from canon 40D to my computer can someone give me direction? Thank you

  • Asmlib for solaris

    Hi experts what is the location to download asmlib for solaris thanx