VIN decoder works again - thanks to Sonic

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • S2central.net
    Retired OG Mod
    • Jul 2003
    • 16590
    • Country: Northern Ireland

    #1

    VIN decoder works again - thanks to Sonic

    Just wanted to give public thanks and appreciation to a new member called Sonic who is obviously a committed webhead and Audi S2 fan. He spotted the bugs I introduced to my clunky attempts at Javascript and utterly re-wrote the decoder. It lives again at http://s2central.net/vindecoder.html - sincere thanks to Sonic for that and welcome to the forum.

    Now its not working perfectly yet - cos of my logic - not out of anything Sonic did wrong. I need to tweak it to support the RS2 VIN and theres doubtless lots of cars I don't cover. Hopefully I wont break the code again

    Another thing is I want to capture the correct 'TYPE' variants for the various chassis/models - like you know how we have Type 85, 89, B3, B4 etc etc - I've never found a site on the 'net that clearly defines all of these... I know there are some experts on this forum that can start me off here.

    Below is a snippet of the vin decoder for the models that I currrently know of - if anyone can post info with the correct vehicle TYPE codes for these it would be great. I'm sure there's mistakes and typos in there so any updates are greatly appreciated

    Theres a prize for the 1st person to get me the VIN for an R8 !

    Thanks,

    Paul


    if (decode.typeCode == '80') {
    decode.type = 'Type 80 Unknown';
    } else if (decode.typeCode == '81') {
    decode.type = 'Type 81 Unknown';
    } else if (decode.typeCode == '82') {
    decode.type = 'Type 82 Unknown';
    } else if (decode.typeCode == '83') {
    decode.type = 'Type 83 Unknown';
    } else if (decode.typeCode == '84') {
    decode.type = 'Type 84 Unknown';
    } else if (decode.typeCode == '85') {
    decode.type = 'Series 2 80 Coupe and UR quattro, 1980 - 1991';
    } else if (decode.typeCode == '86') {
    decode.type = 'Audi 50, 10/74 - 7/78';
    } else if (decode.typeCode == '87') {
    decode.type = 'Series 2 80/90 Saloon, 1980 - 1986';
    } else if (decode.typeCode == '88') {
    decode.type = 'Type 88 Unknown';
    } else if (decode.typeCode == '89') {
    decode.type = 'Series 3 80/90 Saloon, 9/86 - 9/91';
    } else if (decode.typeCode == '8A') {
    decode.type = 'Series 3 80/90 Saloon, 9/86 - 9/91';
    } else if (decode.typeCode == '8B') {
    decode.type = 'Series 3/4 Coupe, 1989 - 12/95';
    } else if (decode.typeCode == '8C') {
    decode.type = 'Series 3/4 80/90 Saloon & Avant';
    } else if (decode.typeCode == '8D') {
    decode.type = 'Series 1 A4 Saloon & Avant, 11/94 - 11/00';
    } else if (decode.typeCode == '8E') {
    decode.type = 'Series 2 A4 Saloon & Avant, 11/00 - ....';
    } else if (decode.typeCode == '8F') {
    decode.type = 'Type Unknown';
    } else if (decode.typeCode == '8G') {
    decode.type = '80 Cabriolet';
    } else if (decode.typeCode == '8L') {
    decode.type = 'A3 (1996 - ....)';
    } else if (decode.typeCode == '8N') {
    decode.type = 'TT (1998 - ....)';
    } else if (decode.typeCode == '8Z') {
    decode.type = 'A2 (1999 - ....)';
    } else if (decode.typeCode == '42') {
    decode.type = 'Series 1 100 & Coupe, 12/63 - 8/76 ???';
    } else if (decode.typeCode == '43') {
    decode.type = 'Series 2 100/200 Saloon & Avant, 8/76 - 9/82';
    } else if (decode.typeCode == '44') {
    decode.type = 'Series 3 100/200 Saloon & Avant, 9/82 - 11/90 (Also some V8\'s from 10/88 ?)';
    } else if (decode.typeCode == '4A') {
    decode.type = 'Series 4 100 (UrA6), 11/90 - 4/97';
    } else if (decode.typeCode == '4B') {
    decode.type = 'A6, 4/97 - ....';
    } else if (decode.typeCode == '4C') {
    decode.type = 'V8, 10/88 - 3/94';
    } else if (decode.typeCode == '4D') {
    decode.type = 'A8, 3/94 - ....';
    Paul Nugent
    Webmaster http://S2central.net
    Administrator http://S2forum.com

    1994 S2 Coupe ABY - aka Project Lazarus
    2001 A6 allroad 2.5TDi - family tank
    2003 S4 Avant 4.2 V8 - daily burble

    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

    There are only 10 kinds of people that understand binary - those that do, and those that don't
  • S2central.net
    Retired OG Mod
    • Jul 2003
    • 16590
    • Country: Northern Ireland

    #2
    } else if (decode.typeCode == '44') {
    decode.type = 'Series 3 Audi 100/200 Saloon & Avant including quattro, 9/82 - 11/90 (Also some V8's from 1989 thru 1994)';


    } else if (decode.typeCode == '8C') {
    decode.type = 'Series 3/4 Audi 80/90 Saloon & Avant (1992-1996) including quattro variants and RS2 Avant (1994-1996)';


    } else if (decode.typeCode == '81') {
    decode.type = 'Series 2 Audi 80 Saloon 1979-1987';

    } else if (decode.typeCode == '82') {
    decode.type = 'Series 2 Audi 80 Saloon 1973-1978';

    } else if (decode.typeCode == '83') {
    decode.type = 'Series 2 Audi 80 Saloon 1973-1978';

    } else if (decode.typeCode == '84') {
    decode.type = 'Series 2 Audi 80 Saloon 1973-1978';

    } else if (decode.typeCode == '85') {
    decode.type = 'Series 2 Audi 80 Coupe including quattro variant (1981 - 1988) and UR quattro, 1980 - 1991';
    Paul Nugent
    Webmaster http://S2central.net
    Administrator http://S2forum.com

    1994 S2 Coupe ABY - aka Project Lazarus
    2001 A6 allroad 2.5TDi - family tank
    2003 S4 Avant 4.2 V8 - daily burble

    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

    There are only 10 kinds of people that understand binary - those that do, and those that don't

    Comment

    • ericd
      S2Forum Extremist
      • Nov 2003
      • 1240
      • Country: Scotland

      #3
      Originally posted by S2central.net
      } else if (decode.typeCode == '44') {
      decode.type = 'Series 3 Audi 100/200 Saloon & Avant including quattro, 9/82 - 11/90 (Also some V8's from 1989 thru 1994)';


      } else if (decode.typeCode == '8C') {
      decode.type = 'Series 3/4 Audi 80/90 Saloon & Avant (1992-1996) including quattro variants and RS2 Avant (1994-1996)';


      } else if (decode.typeCode == '81') {
      decode.type = 'Series 2 Audi 80 Saloon 1979-1987';

      } else if (decode.typeCode == '82') {
      decode.type = 'Series 2 Audi 80 Saloon 1973-1978';

      } else if (decode.typeCode == '83') {
      decode.type = 'Series 2 Audi 80 Saloon 1973-1978';

      } else if (decode.typeCode == '84') {
      decode.type = 'Series 2 Audi 80 Saloon 1973-1978';

      } else if (decode.typeCode == '85') {
      decode.type = 'Series 2 Audi 80 Coupe including quattro variant (1981 - 1988) and UR quattro, 1980 - 1991';
      think you've missed a {

      Comment

      • Whitedog
        S2Forum Enthusiast
        • Jan 2007
        • 142
        • Country: England

        #4
        Its all to me.

        Does look very impressive though, well done paul and sonic.

        Comment

        • audiman
          S2Forum Freak
          • Jul 2003
          • 4827
          • Country: United Kingdom

          #5
          WTF is that lot? LMAO.

          I need that decoding please
          sigpic
          Tom C - www.rcmr.co.uk
          Audi UR Quattro
          Audi 100 C3 2.0 5 cyl 115ps
          Audi S2 - 07k engine project aiming for 800ps
          Audi B5 RS4 645ps 911nm

          Comment

          • Audi Parts Guru
            S2Forum Extremist
            • Jul 2003
            • 1317
            • Home: England Current: United Kingdom

            #6
            Originally posted by S2central.net
            Theres a prize for the 1st person to get me the VIN for an R8 !
            What's the prize Paul ?
            S2 Avant......fully loaded :rock: :bow: Slipper Wagons Rule !!!!!

            Comment

            • S2central.net
              Retired OG Mod
              • Jul 2003
              • 16590
              • Country: Northern Ireland

              #7
              Oh I dunno - sure I have something lying about thats useful for an S2
              Paul Nugent
              Webmaster http://S2central.net
              Administrator http://S2forum.com

              1994 S2 Coupe ABY - aka Project Lazarus
              2001 A6 allroad 2.5TDi - family tank
              2003 S4 Avant 4.2 V8 - daily burble

              Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

              There are only 10 kinds of people that understand binary - those that do, and those that don't

              Comment

              • S2central.net
                Retired OG Mod
                • Jul 2003
                • 16590
                • Country: Northern Ireland

                #8
                Right I have added further updates to the javascript to cover some newer Audi models. It should now also cover the RS2 special case - can RS2 owners please test that out.



                If anyone can shine light on the special VINs for the Quattro GMBH locations and the confusing array of 80/90 models that would be great.

                Please do let me know if any valid VIN you have gets decoded incorrectly.

                PS - I have finally found a decent html editor that will allow me to make long awaited updates to the site much quicker and easier. I'll not bore you with the previous painful process. This will enable me to write up things like the 8E0 brake upgrade and more ECU information thats itching to get published properly.

                Paul
                Paul Nugent
                Webmaster http://S2central.net
                Administrator http://S2forum.com

                1994 S2 Coupe ABY - aka Project Lazarus
                2001 A6 allroad 2.5TDi - family tank
                2003 S4 Avant 4.2 V8 - daily burble

                Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                There are only 10 kinds of people that understand binary - those that do, and those that don't

                Comment

                • Jamo
                  Retired OG Mod
                  • Mar 2004
                  • 21750
                  • Country: United Kingdom

                  #9
                  Geez my eyes hurt! lots of else if statements! It works but it's untidy and is a pain to modify.

                  If you get time you should try playing with the "case" function of scripting.

                  Example here



                  Haven't done javascripting myself but do korn and bourne shell scripting and the same principle apply.

                  For example

                  switch (decode.typeCode)
                  {
                  case (decode.typeCode = '80'):
                  decode.type = 'Type 80 Unknown';
                  break;
                  case (decode.typeCode = '4D'):
                  decode.type = 'A8, 3/94 - ....';
                  break;
                  }

                  Whether you need == or = would need testing, but by doing it like that you can add and subtract entries from the switch conditions easier.
                  Last edited by Jamo; 28 June 2007, 00:59.

                  Comment

                  • S2central.net
                    Retired OG Mod
                    • Jul 2003
                    • 16590
                    • Country: Northern Ireland

                    #10
                    I'm not so worried about case vs if-else... Sure the latter looks untidy but anyway - I've just updated it again tonight with all the 'platform' info that I can find that relates to the 'type' nomenclature that appears in the VIN.

                    I think I've unravelled the 80/90 variant confusion now

                    Only gotchas are the TYPE codes for a B7 based RS4, the C6 based A6/S6 and the R8... Oh and the Q7 as well. Maybe some others have sneaked thru the net - its a bit dull this subject but its amazing how many emails I got from around the world telling me my Audi VIN decoder was broke - so I wanted to fix it.

                    Thanks to Sonic its back on-line and I've somehow summoned the energy to update it tonight. Shock horror !

                    Paul
                    Paul Nugent
                    Webmaster http://S2central.net
                    Administrator http://S2forum.com

                    1994 S2 Coupe ABY - aka Project Lazarus
                    2001 A6 allroad 2.5TDi - family tank
                    2003 S4 Avant 4.2 V8 - daily burble

                    Purveyor of HomeFries and Exclusive agent for Samco hose kits (S2/RS2)

                    There are only 10 kinds of people that understand binary - those that do, and those that don't

                    Comment

                    • Sonic
                      Administrator
                      • Jul 2006
                      • 5514
                      • Home: United Kingdom Current: England

                      #11
                      Jamo is right, switch statements would decrease the amount of lines of code and increase performance, but this is hardly a performance critical script script. And besides, the if conditions were already written =P

                      = is an assignment e.g. var name = 'value'
                      == is a value comparison e.g. if (var == 'value') {}
                      === is a type and value comparison

                      What you would do, for the record, is:

                      switch (decode.typeCode)
                      {
                      case '80':
                      decode.type = 'Type 80 Unknown';
                      break;
                      }

                      My work is complete
                      S2Forum.com Administrator

                      Comment

                      Working...