PDA

View Full Version : Need help to search a local CSV


Spaull69
02-15-2009, 02:48 PM
Hi People

I am a relative beginner on javascript and relatively no knowledge of php etc.

I am developing a local dashboard (webpage) for myself and my collegues to try to link all things we require in our day to day work into a single page. (well thats the plan)

This page will be stored on a local drive (not on a web server) and accessing local files etc on the local drive.

One function i need is the ability to search in a local CSV or txt file for a phrase/word and have it return the results of that line in the csv/txt file to a table or text view on the page.

I was thinking Javascript would probably work. i have some other javascript on the page already performing a some simple combo dropdown functions for selecting products etc.

Fundamentally I am trying to give the user the ability to type in the model code of a requested product and have the page show up if the model is listed the csv or txt file and if so what price it is.

Any help would be much appreciated.

Thanks in advance

Old Pedant
02-15-2009, 10:45 PM
Ummm...maybe you could do this with JavaScript. But this is the wrong forum for that question. JSP and Java have essentially nothing to do with JavaScript except a (purposeful, on the part of Netscape more than 10 years ago) coincidence of PART of the name. "Java".

You need to find a good JavaScript forum.

But I can tell you now that it order to make this work you will *probably* need to use Microsoft Internet Explorer and then use scripting on either the "Scripting.FileSystemObject" or on the "ADODB.Connection" and "ADODB.Recordset" objects. Not terribly hard to do. But then all the users will have to (a) mark your "site" as "trusted connection" (else MSIE won't allow scripting those components) and (b) even so, probably have to give permission on each use for the page to use these "dangerous" components. [Dangerous, because either could be used to wipe out files on the users' disk drives.]

It really would be better to implement this as server-side code (JSP, ASP, PHP, ASP.NET) on a web server. Where the safety issues don't arise. And then your users could use any browser they chose to.