1 Reply Latest reply on Mar 28, 2015 11:20 AM by philmodjunk

    Card Reader, Reading a Drivers Liscense Script

    WilliamSouth

      Title

      Card Reader, Reading a Drivers Liscense Script

      Post

      I have been trying to make set field script that deciphers all information that the card reader gets off a drivers license. My script work for  some drivers licenses, but I am realizing that not all of the code on the drivers licenses are made exactly the same for example (information has been altered so I am not giving anyones info)

      DRIVER INFO  FROM CARD READER  (WORKS CORRECTLY)

      EXAMPLE A

      %3%FLSUNRISE^SMITH$BOB$JOHN^8888 NW 777TH ST?;6360101912121212121=2009197899130=?+! 33333  E               1508                                   ECCECC00000?3322  E               1508                                   ECCECC00000?

      FIRST NAME= LeftWords(Substitute(Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G ; "$" ; 1 ; 1 ) + 1 ; Position ( Customer::FULL LICENSE_G; "^" ; 30 ; 1)- Position ( Customer::FULL LICENSE_G; "$" ; 1 ;1 ) -1  );"$";" ");1)

      LAST NAME =Middle ( Customer::FULL LICENSE_G ; Position ( Customer::FULL LICENSE_G ; "^" ; 1 ; 1 ) + 1; Position ( Customer::FULL LICENSE_G ; "$"; 1 ; 1 ) - Position ( Customer::FULL LICENSE_G; "^" ; 1 ; 1 ) - 1 )

      ADDRESS= Substitute (Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G; "^" ; 1 ; 2 ) + 1 ; Position ( Customer::FULL LICENSE_G; "?" ; 30 ; 1)- Position ( Customer::FULL LICENSE_G ; "^" ; 1 ;2 ) -1  );"^";"")

      CITY=Right(Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G ; "%" ; 1 ; 1 ) + 1 ; Position ( Customer::FULL LICENSE_G; "^" ; 1 ; 1)- Position ( Customer::FULL LICENSE_G ; "%" ; 1 ;1 ) -1  );Length(Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G ; "%" ; 1 ; 1 ) + 1 ; Position ( Customer::FULL LICENSE_G; "^" ; 1 ; 1)- Position ( Customer::FULL LICENSE_G ; "%" ; 1 ;1 ) -1  ))-2)

      STATE=Left(Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G ; "%" ; 1 ; 1 ) + 1 ; Position ( Customer::FULL LICENSE_G; "^" ; 1 ; 1)- Position ( Customer::FULL LICENSE_G ; "%" ; 1 ;1 ) -1  );2)

      ZIP=Substitute(Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G ; "!" ; 1 ; 1 ) +2 ; Position ( Customer::FULL LICENSE_G; "E" ;1 ; 1) -3- Position ( Customer::FULL LICENSE_G ; "!" ; 1 ; 2 ) -1);"E";"")

      DRIVER LICENSE =Left(Customer::LastName;1)&Right(Middle ( Customer::FULL LICENSE_G; Position ( Customer::FULL LICENSE_G ; ";" ; 1 ; 1 ) +1 ; Position ( Customer::FULL LICENSE_G; "=" ;1 ; 1) - Position ( Customer::FULL LICENSE_G ; ";" ; 1 ; 1 ) -1);11)

       

      BELOW IS A SWIPE OF ANOTHER CARD BUT THE ABOVE CALC, (DOSE NOT WORK CORRECTLY)EXAMPLE B

      %FLFORT LAUDERDAO\OCCONOR$JOHN$JIMMY^1111 ONE WAY MANOR DR^                ?;6360101533333333333=1804199099120=?+! 33322  E               1511                                   ECCECC00000?

        • 1. Re: Card Reader, Reading a Drivers Liscense Script
          philmodjunk

          Parsing driver's license info can be a real pain. I've done it for California licenses and, at least in CA, the apparent exceptions--sometimes due to some incorrectly encoding the data (My guess here) will drive you crazy.

          Unless you can successfully research out a document that describes the "rules" by which data is encoded, you have to collect data from multiple licenses from the same state and figure it out by inspecting the data in each.

          Some of this looks the same as CA licenses, I suspect that up to 22 characters are used for the State Abbreviation and City name. If there are less than 20 characters needed to name the city, that sub string is terminated by a ^ character if there are 20 or more characters, no delimiter is used. So you have to look for the position of the ^ character, but treat it as the terminator for the person's name if it is more than 22 characters into that part of the screen. I used the let function with an If function to compute the position of such points as the last character of the city name so that I could handle such variations.

          But you'll also have to figure out why the first license scan starts with %3% and the second example starts with %.

          I ended up breaking the text up into smaller logical sub strings based on the presence/absence of those delimiters (and the number of $ delimitters for names were not the same on each license...) and still needed a very long complex script to parse out all of the data. (And what you show looks like track 1 where additional data might be encoded on tracks 2 and 3....)