We're aware that some users are experiencing technical issues which the team are working to resolve. See the Community Noticeboard for more info. Thank you for your patience.
📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!

A question for software techies

Options
Vic_980
Vic_980 Posts: 115 Forumite
I'm doing an I.T. project at Uni and am building some software for a made-up used car dealer.

I'm trying to get hold of a list of all car manufacturers and models, so I can put it in some drop down boxes for customers to provide a database search facility (similar to the quick search here: https://www.autotrader.co.uk). e.g. You click AUDI and you get a list which narrows down to A2, A3, A4 etc.

Managed to get the dropdown code working, but I'd really like to put some real data in there.

Does anyone know of anywhere where I can get this info from (preferably in either table / excel or XML format).

Or does anyone know a clever way of extracting this data from the dropdowns on a existing website (cough).

My fingers are hurting typing it all in!

Comments

  • woo
    woo Posts: 1,226 Forumite
    Part of the Furniture 1,000 Posts Combo Breaker
    on the site where you have seen these drop downs can you do a view page source in a browser and copy the html select or are they not visible? on the auto trader..

    just done it and didn't quite work. managed to save the html locally and you can extract the options e.g. <option value="AC">AC</option><option value="AIXAM">AIXAM</option><option value="ALFA ROMEO">ALFA ROMEO</option><option value="ARIEL">ARIEL</option><option value="ASIA">ASIA</option><option value="ASTON MARTIN">ASTON MARTIN</option><option value="AUBURN">AUBURN</option><option value="AUDI">AUDI</option><option value="AUSTIN">AUSTIN</option><option value="BENTLEY">BENTLEY</option><option value="BMW">BMW</option><option

    maybe if you select the car then you might get be able to see the model list as well?
    Ever stop to think and forget to start again?
  • Vic_980
    Vic_980 Posts: 115 Forumite
    Done that, the dropdowns are populated via a Javascript array which is held in a separate file (_make_model.js).

    Trick is now converting this into a table or spreadsheet form!
  • ManAtHome
    ManAtHome Posts: 8,512 Forumite
    Part of the Furniture Combo Breaker
    This may help (I think you'll need GROUP.DAT)
    http://www.abi.org.uk/carinsurance/download.asp

    ps. if you download it then rename as GROUP.TXT you can use Exel text file parser (fixed width) to split into columns (excuse if you already knew that)
  • NellyLock
    NellyLock Posts: 487 Forumite
    Vic_980 wrote:
    Done that, the dropdowns are populated via a Javascript array which is held in a separate file (_make_model.js).

    Trick is now converting this into a table or spreadsheet form!

    here you go...here that model.js as a spreadsheet anyway

    https://www.neillock.co.uk/model.xls

    neil
  • Vic_980
    Vic_980 Posts: 115 Forumite
    Sorted - wonderful stuff people!

    I'll put some mentions in the project thanking you for all your help!!!!
  • Chippy_Minton
    Chippy_Minton Posts: 3,339 Forumite
    Well, NellyLock beat me to it, but I might as well post my code now that I've finished it :) :

    1. Save _make_model.js somewhere on your C: drive.

    2. Copy and paste the following code into Notepad and save it as cars.html in the same directory.
    <HTML><HEAD>
    <SCRIPT type="text/JavaScript" language="JavaScript" src="_make_model.js"></SCRIPT>
    <SCRIPT LANGUAGE='JavaScript'> 
    function createCarsFile()
    !!
         var filename = 'c:/temp/cars2.txt'; 
         var fso = new ActiveXObject('Scripting.FileSystemObject'); 
         var file = fso.CreateTextFile(filename, true);
         var i, j;
         for (i = 2; i < make_v.length; i++) // Start from 2 to skip 'MAKE' and 'ANY' make
         !!
            file.Write(make_v[i] + ",");
            for (j = 1; j < _model[i].length; j++) // Start from 1 to skip 'ANY' model
            !!
    	    file.write(_model[i][j] + ",");
            }
            file.writeLine();
         }
         file.Close();
         alert(filename + " created");
    } 
    </SCRIPT> 
    </HEAD> 
    <BODY onload='createCarsFile()'> 
    </BODY> 
    </HTML>
    
    3. Using Internet Explorer (you can't use Firefox etc. because the above uses ActiveX), open cars.html.

    4. You've created c:\temp\cars.txt, which is a CSV file.

    NB - in the above code change the 3 occurrences of "!!" to an opening curly bracket (the forum doesn't like me typing it!)
  • NellyLock
    NellyLock Posts: 487 Forumite
    eheh i went the non-techy root ;) im so proud of myself (what a computer scientist i am :) )...wacked it into excel and then split into columns ;) using different delimeters...took seconds...:)
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 350.8K Banking & Borrowing
  • 253.1K Reduce Debt & Boost Income
  • 453.5K Spending & Discounts
  • 243.8K Work, Benefits & Business
  • 598.7K Mortgages, Homes & Bills
  • 176.8K Life & Family
  • 257.1K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16.1K Discuss & Feedback
  • 37.6K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.