Increase digits

A discussion of how to use EasyPatterns, EasyPattern Helper and using the EasyPattern library.

Moderator: DataMystic Support

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Increase digits

Postby DataMystic Support » Thu May 19, 2011 9:48 am

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
   
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

sardaukar
Posts: 6
Joined: Thu Apr 04, 2013 9:01 pm

Re: Increase digits

Postby sardaukar » Wed Apr 24, 2013 5:49 pm

If someone can teach me how to change this script to reset on every file? I try but unsuccessfully.
Thank you!

User avatar
DataMystic Support
Site Admin
Posts: 2164
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: Increase digits

Postby DataMystic Support » Fri Apr 26, 2013 12:22 pm

Sure, change startFile to

Code: Select all

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

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

sardaukar
Posts: 6
Joined: Thu Apr 04, 2013 9:01 pm

Re: Increase digits

Postby sardaukar » Sun Apr 28, 2013 12:02 am

:D Finally :oops:
Thank you :D


Return to “EasyPatterns Support”

Who is online

Users browsing this forum: No registered users and 2 guests