Gossamer Forum
Home : Products : DBMan : Customization :

Creating an external text file of fields

Quote Reply
Creating an external text file of fields
Hi, this is my first post so I am hoping someone can help me. I have been reading for some time now and I know there are some very intelligent folks reading and helping others.

What I would like to do is simply have a button available to the ADMIN that would allow them to create an external file (ie. an SHTML file) with the following info:

<option>$rec{'Name'}, $rec{'City'}, $rec{'State'}</option>

I have been successful in appending a file each time an item is added, unfortunately, whenever the database changes it doesn't update the file (for obvious reasons--it only adds info).

What I would like to do is just replace the file each time but list every single record in the database in the shtml file. There are no filters. If there are 40 records, there should be 40 lines of the above, for each record in the database.

PLEASE PLEASE HELP!! Thanks
Quote Reply
Re: [donnam] Creating an external text file of fields In reply to
There is an external text file mod which will allow admin to do a search and choose to create a .txt file from the database and include whatever fields you want. This is available in the FAQ or from JPDeni's site at http://jpdeni.com/dbman/

There have also been mods to create an .htm page when records are added or modified. I'm not sure this mod is in the FAQ yet, but it can be found within the support forum. Sorry, I don't know the exact url or what it was called.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Creating an external text file of fields In reply to
Thanks LoisC,

Unfortunately the mod that jpdeni has is one that will allow an individual to enter information in a TEXT field and then that information is stored in a text file (the text file is actually the record number ID). I did try to use this originally and modify it slightly, that is how I got what I did to work. Basically it saves certain information to a file as records are added, unfortunately if the record is modified or deleted it is not modified or deleted in the external file. There is no intelligence to the file.

I am going to look around to see if there is some other information as you suggested.

Unfortunately, I'm not a programmer but I play one in my spare time (haha). The routine would have to be a looped routine that would repeat the file write per record.

Thanks again! If you find anything else pls let me know!
Quote Reply
Re: [donnam] Creating an external text file of fields In reply to
I'm sorry I was tired and referenced the wrong mod :)

This is the mod that you can use as an addition to your search form, and just make it available to admin. Then you can do a new search at any time and get an updated printout of the database records.

From the FAQ under the section "Files" the thread is called:
Output fields to a text file (sub html_printout)

The original thread is:

http://gossamer-threads.com/p/000848
Topic: Output a text file
hooter - August 29, 1999

--------
I checked my notes and found another thread of interest:

http://gossamer-threads.com/p/192949

Hope this helps

Creating Readable text file on server
davidolley
22-Apr-2002

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Creating an external text file of fields In reply to
The mod with my name on it is almost certainly too big for your purposes.

If you go to http://www.hampshires.net/cgi-bin/test/db.cgi you will find a basic version of dbman which I have just modified to provide what I think you might need. I have only changed the html.pl file.

Sign in (as indicated) then hit List All.

Then (using another browser window) go to www.hampshires.net/records.htm to see the file that was created. Not all records are returned to this file, but it is easy to write it as you wish. Add a new record, then Select All again. Then refresh the records.htm screen. You should see your new record added to the list.

To see the script, just go to www.hampshires.net/html.pl.txt and www.hampshires.net/records.htm.txt to view the sources. The new lines are between line 119 and 176 in the html.pl file.

If this is not what you want, please explain again.

You will see that the way I quickly wrote this, using the standard dbman set-up, it is necessary to select each of the pages of records to print them to the html file. Any new records will appear in the very last page of results. The best way round this, if starting a db from scratch, is to move my modified code to within the Add Record subroutine. But then you will have the problem of modified or deleted records to contend with.

Probably the best solution is to write a new sub-routine specifically to go through all records and print the html file from the up-to-date database.

Hope this helps.
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.
Quote Reply
Re: [LoisC] Creating an external text file of fields In reply to
LouisC --

Confused, sorry. I went to the FAQ section and did a search for FILES, is this what you were referring to? I did this and I couldn't find what you referred to. Am I looking in the wrong place? I didn't see an area specifically labeled FILES either. Sorry... please bare with me :)

davidolley --

Tried accessing the file " www.hampshires.net/html.pl.txt " and I receive a server error, sorry. When I access " www.hampshires.net/records.htm.txt " file the screen is blank, sorry.

What I've seen of your mod, it is what I have already done -- don't get me wrong, I do appreciate the information. What I would like to do is what you referenced, create a new sub routine that would go through each record and save specific info from each record to the shtml file. Unfortunately, I don't know the programming necessary to tell it to go through each record.
Quote Reply
Re: [donnam] Creating an external text file of fields In reply to
I checked and that thread is not in the FAQ, sorry. I don't know how I missed adding it.

Please refer to the original thread here in the support forum. If the url is not still valid then search by the subject or the username.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Creating an external text file of fields In reply to
Okay, I got it to work. I saw a post by JPDENI (I think it was the one you were referring to). I used her mod to accomplish what I want. What I do now is, theres a link on the main page that says EXPORT. Once the admin is finished adding whatever information, deleting, or changing, they click on the link and it exports the file.

Works perfect.

Thanks again!
Quote Reply
Re: [davidolley] Creating an external text file of fields In reply to
David:

I was unable to access www.hampshires.net/html.pl.txt also. could you check it and upload again. I'm interested in seeing what you have done :)

Thanks for taking the time to compile this for others

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Creating an external text file of fields In reply to
Sorry about that Lois. I have renamed the files. They can be viewed at www.hampshires.net/html_pl.txt and www.hampshires.net/records_htm.txt

The latter file will be blank until the programme is run: www.hampshires.net/cgi-bin/test/db.cgi

It will work far better if the short/long mod is used because then a new subroutine could easily be added to produce an up-to-date report of whatever records are required - without upsetting the rest of the html outputs. As presently configured it will keep on adding the records displayed by html.pl - but I did it simply as an illustration.
-------------
David Olley
Anglo & Foreign International Limited,
http://www.firehelmets.co.uk

There are 10 types of people in the world: those who understand binary, and those who don't.

Last edited by:

davidolley: Dec 30, 2002, 4:21 AM