3 Replies Latest reply on May 11, 2009 5:32 AM by ice9_us

    filter on strings

    ice9_us Level 1

       

       

       

       

       

       

       

      public

       

       

       

      var result:XMLList = new XMLList;

      /// hd_ticketKey hd_ticketNumber

      result = item.(@hd_ticketNumber == hdsearch.text || @hd_ticketKey == hdsearch.text);

       

       

      if ( result.length() > 0 ) {

       

       

      return true;

      }

      else {

       

       

      return false;

      }

       

      hd_number will == Disk issue or disk_issue...

      When i enter the info for my search i may type   disk and want the search to hit on both..

      how do i do that where you see

       

      result = item.(@hd_ticketNumber == hdsearch.text...

       

      can i even do it? I am not able to find any info on this.

      function filterhddata(item:XML):Boolean {

       

        • 1. Re: filter on strings
          ice9_us Level 1

          this cut out lots of stuff in my function..

           

           

           

           

           

           

           

           

           

          public

           

           

           

          var result:XMLList = new XMLList;

          /// hd_ticketKey hd_ticketNumber

          result = item.(@hd_ticketNumber == hdsearch.text || @hd_ticketKey == hdsearch.text);

           

           

          if ( result.length() > 0 ) {

           

           

          return true;

          }

          else {

           

           

          return false;

          }

          function filterhddata(item:XML):Boolean {

           

          • 2. Re: filter on strings
            ntsiii Level 3

            Sorry, I am not following your question.  What is not working?

             

            Tracy

            • 3. Re: filter on strings
              ice9_us Level 1

              here ya go..

              i want to get a hit on any combo of keys i type..

              if it is in either col..

               

              so if i type disk or Disk it will come up with any thing that has the work "disk" in it.. same thing with the numebrs..

              2 brings up everything with a 2

               

              <?xml version="1.0" encoding="utf-8"?>

              <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">

                    

              <mx:Script>

                   <![CDATA[

                        import mx.messaging.channels.StreamingAMFChannel;

                        import mx.messaging.AbstractConsumer;

                        import mx.events.ListEvent;

                        import mx.collections.ArrayCollection;

                        import mx.collections.XMLListCollection;

                        import mx.states.SetProperty;

                        import mx.events.ItemClickEvent;

                        import mx.managers.SystemManager;

                        import mx.rpc.events.ResultEvent;

                        import mx.rpc.events.FaultEvent;

                        import mx.core.Application;

                        import mx.controls.Alert;     

               

              public function init():void {

                   get_ticketList2.send();

              }     

                   public function filterhddata(item:XML):Boolean {

                   var result3:XMLList = new XMLList; 

                   //var result:Number = new Number;

                   //var result2:Number = new Number;

                   //var s:String = new String;

                   result3 = item.(@hd_ticketNumber == hdsearch.text || @hd_ticketKey == hdsearch.text);

                   //s = item.@hd_ticketNumber.toString();

                   //result = s.indexOf(hdsearch.text);

               

                   if ( result3.length() > 0 ) {

                   //if ( result3.length > 0 || result > 0   ) {

                        return true;

                   } else {

                        return false;

                   }

                         

              }

               

              public function filterdata():void {

                   if ( hdsearch.text != "" ) {

                        ticketListCol.filterFunction = filterhddata;

                   } else {

                        ticketListCol.filterFunction = null;

                   }

                   ticketListCol.refresh();

              }

               

              public var ticketList:XMLList = new XMLList;

              public var ticketListCol:XMLListCollection = new XMLListCollection;

               

              public function relatePR():void {

               

                   get_ticketList2.send();

                   //modifyrelation.send();

              }

              public function get_ticketList(event:ResultEvent):void {

                   ticketList=event.result.GetTicketData;

                   ticketListCol.source = ticketList;

              }

               

              /********************************************************************************/

              public function faultHandler(event:FaultEvent):void {

                        Alert.show(event.fault.faultString, event.fault.faultCode);

              }

              /********************************************************************************/

               

                   ]]>

              </mx:Script>

              <mx:HTTPService id="get_ticketList2" url="http://softnetinc.net/cgi-bin/get_ticketList.cgi" method="GET" result="get_ticketList(event)"

                   fault="faultHandler(event)" resultFormat="e4x" />

               

               

                   <mx:AdvancedDataGrid x="201.5" y="220" id="ticketListDisplay" designViewDataType="flat" height="148" dataProvider="" width="386" >

                        <mx:columns>

                             <mx:AdvancedDataGridColumn headerText="PR_Number" dataField="@hd_ticketKey" width="70"/>

                             <mx:AdvancedDataGridColumn headerText="PR_Name" dataField="@hd_ticketNumber" width="200"/>

                        </mx:columns>                         

                   </mx:AdvancedDataGrid>

                   <mx:TextInput id="hdsearch" x="33.5" y="220" enter="filterdata()"/>

              </mx:Application