Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Work with text file
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Work with text file

 Post Reply Post Reply
Author
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Topic: Work with text file
    Posted: 10 February 2003 at 4:07pm

I have an application that can only export to a comma delimited text file. The application does not let me format what data is incuded basically spits out the whole table. I cannot query the table directly because first it's not in the same network then the webserver and it's BTrieve

Now my question, I created a file which takes that text file, formats it a little and displays it within an intranet. Now there are three columns that I don't want to display ( the first, third and fourth) where the whole text file has like 10 columns. Anyone got an idea how?? No ideas how to query a text file and the person who is gonna do the exports will not go through the process of importing them to a database.
Here is what I have so far:

<%
' This script only works with the interchange export from OPS
fontsize = "-5"      'please specify the desired font size here  -6 , -5 , .... , +5 , +6
fontface = "Times New Roman"  'please specify the desired font face here  (Arial or whatever you prefer.)
whichfile=server.mappath("/export.txt") 'change the filename of the txt file here, have it in the same dir as this asp file

Set fs = CreateObject("Scripting.FileSystemObject")
Set thisfile = fs.OpenTextFile(whichfile, 1, False,TristateFalse)

counter=0
do  while not thisfile.AtEndOfStream
  
   thisline=thisfile.readline
   tableline = "<tr><td nowrap><font size=" & fontsize & " face=" & fontface & ">" & Replace(thisline,",","</td><td nowrap><font size=" & fontsize & " face=" & fontface & ">") & "</td></tr>"
   tableline = Replace(tableline,"""","")
   Response.Write tableline
loop

thisfile.Close
set thisfile=nothing
set fs=nothing
%>

Back to Top
Str8Dog View Drop Down
Senior Member
Senior Member


Joined: 18 December 2001
Location: United States
Status: Offline
Points: 2118
Post Options Post Options   Thanks (0) Thanks(0)   Quote Str8Dog Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2003 at 4:45pm
you could set up the CSV as a linked table inside an access DB. This would allow you to query it.
[IMG"> http://www.str8dog.com/images/str8dog.gif">
I wasn't born with enough middle fingers.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 10 February 2003 at 5:38pm
This is actually not a bad idea. Though would I need to setup a DSN for the CSV or does it go without.
Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2003 at 5:25pm

I think you can connect to a text file as if it were a recordset, you can then manipulate which rows you wish to display.

http://www.able-consulting.com/MDAC/ADO/Connection/OLEDB_Providers.htm#OLEDBProviderForMicrosoftJetText

http://www.able-consulting.com/MDAC/ADO/Connection/ODBC_DSNLess.htm#ODBCDriverForText

Hope this helps,
Andrew

There have been many, many posts made throughout the world...
This was one of them.
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 11 February 2003 at 5:43pm
Thanks Bunce, actually converting it to a csv did the whole trick. Sometimes it is so close you don't see it :)
Back to Top
gupta_ji View Drop Down
Groupie
Groupie
Avatar

Joined: 29 October 2003
Location: India
Status: Offline
Points: 70
Post Options Post Options   Thanks (0) Thanks(0)   Quote gupta_ji Quote  Post ReplyReply Direct Link To This Post Posted: 30 October 2003 at 9:02am
you could set up the CSV as a linked table inside an access DB. This would allow you to query it.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.