Page 1 of 1

Re: Increase digits

Posted: Thu May 19, 2011 9:48 am
by DataMystic Support
Hmmm, can be done with a script filter inside a Restrict to first pipe delimited field filter.

You just need to create an array with each term, and increase the count for each arrival. We used the VBScript dictionary object - http://www.4guysfromrolla.com/webtech/102898-1.shtml

The filter looks like this:

Code: Select all

Restrict fields:Pipe-delimited field 1 .. field 1
|  [X] Process fields individually
|    [X] Exclude delimiter
|      [ ] Exclude quotes (if present)
|  Delimiter Type: 3
|  Custom delimiter: 
|  [ ] Has Header
|
+--VBScript script  Timeout: 10000 milliseconds
      'counter for each occurrence of city name
      
      'Our city array
      Dim cities
      dim c
      
      
      function processLine(line, EOL)
      
        if cities.Exists(line) then
          c = cities.Item(line) + 1
          cities.Item(line) = c
        else
          cities.Add line, "1"
          c = 1
        end if
        
        processLine = line & " " & c & EOL
      end function
      
      
      sub startJob()
        Set cities = CreateObject("Scripting.Dictionary")
      end sub
      
      
      sub endJob()
      end sub
      
      
      function startFile()
        startFile = ""
      end function
      
      
      function endFile()
        endFile = ""
      end function
    

Re: Increase digits

Posted: Wed Apr 24, 2013 5:49 pm
by sardaukar
If someone can teach me how to change this script to reset on every file? I try but unsuccessfully.
Thank you!

Re: Increase digits

Posted: Fri Apr 26, 2013 12:22 pm
by DataMystic Support
Sure, change startFile to

Code: Select all

function startFile()
        startFile = ""
        Set cities = CreateObject("Scripting.Dictionary")
end function
      

Re: Increase digits

Posted: Sun Apr 28, 2013 12:02 am
by sardaukar
:D Finally :oops:
Thank you :D