Gossamer Forum
Home : Products : DBMan : Customization :

Fields are confused

(Page 1 of 2)
> >
Quote Reply
Fields are confused
(To see an example of what I am dealing with:
http://www.icpc4cops.org/cgi-bin/db.cgi User: Joe PW: user).

I am trying to set up a simple database listing, that consists of only 3 fields. Well, 4 with the ID tag (can I omit the ID tag and make the "Number" field my ID tag?).

I save my Excel file to a tab delimited format, and set the cfg tag as \t, from an earlier response.

But when I attempt to list my database online, everything is jumbled together.

I would love to have this online sometime in the 1999 era. heh. =)

-Thanks all.
-Eric


------------------
Quote Reply
Re: Fields are confused In reply to
I've never tried exporting a file from Excel to DBMan, so I don't have any suggestions for you.

I have exported tables from Access, though. I might be able to help you if you wanted to try that.

I would have to see your .db file in order to have some idea of what's going on, though. If you'll copy the default.db file to a web-accessible directory and rename it to default_db.txt, I'll take a look at it and see if I can figure out what the problem is.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Ok. I have a table setup in Access now. What is the proper procedure to export the data so DBman will understand it.

Thanks again.


------------------
Quote Reply
Re: Fields are confused In reply to
 
Quote:
can I omit the ID tag and make the "Number" field my ID tag

Yes, if you're sure your "Number" tag will be unique with each record.

My guess is that you have set up your delimiter incorrectly.

If you're going to use a tab delimiter, you need to use

$db_delim = "\t";

You must put double quotes around the \t part in order for Perl to translate it into a tab character.

If that's not it, I'll need you to save your html.pl file and default.cfg file as .txt files and let me know where I can see them.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Ok, I put the double quotes for the delimiter, that seemed to improve things.
Thank you.

Now, it seems I have a formatting problem when listing the database. For a tab delimited file out of excel, it doesn't seem to read correctly into the program...???

------------------
Quote Reply
Re: Fields are confused In reply to
How do I create an active link for an item found within the database? Meaning, where is the reference tag so the database listing knows where to send the user to view the document?

Here are the addresses for my html.pl and default.cfg files:

www.icpc4cops.org/html_pl.txt
www.icpc4cops.org/icpc_cfg.txt

------------------
Quote Reply
Re: Fields are confused In reply to
To export a table from Access, select the table in the "Table" tab.
Go to the File--Save As/Export menu item.
Make sure you have "To an external file or database" selected on the next screen. Click "Ok."
Select "Text Files" as the file type and type in a name for your database. It would probably be best to use something like "default.txt". Click "Export."
Select "Delimited" on the next screen. Click "Next."
Since you have your database set up to be tab-delmited, select "Tab" on the next screen. Do *not* check the "Include Field Names in Next Row" box. In the "Text Qualifier" select list, choose "{none}." Click "Next."
The next screen will show the path and name of the file you're going to export. Click "Finish."

After the file finishes, rename the file to default.db and upload it. It should work just fine.

Quote:
How do I create an active link for an item found within the database? Meaning, where
is the reference tag so the database listing knows where to send the user to view the
document?

I'm still not sure what you mean. Can you give me an example?




------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Thank you for the Access tip, the data seems to to be much better now. I do not know why I thought Excel was the program of choice.

>> RE: Active Link in database listing

If you go to the database and pull up an item, or do a LIST ALL, see where it shows the TITLE of a document? I would like it so the users can either click that as a link to a document (that opens in a page, or perhaps a new page) or just right-click and download.

Make Sense??

-Thanks.
-Eric


------------------
Quote Reply
Re: Fields are confused In reply to
So you have a field that contains a URL? If so, in order to create a link, you would use

<a href="$rec{'URL'}">$rec{'Title'}</a>

Is that what you want? If not, give me a specific example of a record in your database and the fieldname and explain what you want to do.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
_____________________________________________<a href="$rec{'URL'}">$rec{'Title'}</a>

Is that what you want? If not, give me a specific example of a record in your database and the fieldname and explain what you want to do.
___________________________________________

I did that, but go ahead in the database and look up "AV3". I want the listing of that title to lead to the online document, or at least a file...

Make sense?

Thank you for your help and patience.


------------------
Quote Reply
Re: Fields are confused In reply to
You have

Code:
<A HREF="$rec{'Title'}">$rec{'Title'}</A>

Which would be fine if your Title was a URL. But it's not. You need to have a URL in the <a href=" tag.



------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Ok, I understand that. So, how do I make each record's "Title" list as the URL pointing to that specific file?

------------------
Quote Reply
Re: Fields are confused In reply to
Are all of the files in the same place? Are they all the same format, such as .txt files? If so, what would the URL be for the file
Number: AV3
Title: Second Chance - Magnum Force



------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Each of the files are either going to be .DOC (Word), .PDF (AcroBat), or straight .TXT files - I believe. I am trying to confirm this with the client.

I would set it up so that the "Number" field is the name of whatever file. Is it a problem with the function if the files not all the same type?

------------------
Quote Reply
Re: Fields are confused In reply to
If the files aren't all of the same type, you'll need to say what type they are somewhere.

If you are using your Number field as a the name of the file, you can use something like

<a href="http://url/to/directory/$rec{'Number'}.txt">$rec{'Title'}</a>

That would require that all the files are .txt files.

If they're going to be different types, you'll need to add the type to the Number field. Then you would use

<a href="http://url/to/directory/$rec{'Number'}">$rec{'Title'}</a>

One way or another, the extension part of the file must be included.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Ok. They will all be .PDF files, in one specific directory. Here is what I added:

<a href="http://url/to/directory/$rec{'Number'}.pdf">$rec{'Title'}</a>

Feel free to visit the site again to see the result. It does not work, when I click on the link, this is what that line translates into:

http://www.icpc4cops.org/library/<B>P03</B><B></B>.pdf

I know we are close, heh. =)


------------------
Quote Reply
Re: Fields are confused In reply to
Yep. We're close. Smile

In sub html_record, just after

my (%rec) = @_;

add

Code:
$url = "http://url/to/directory/$rec{'Number'}.pdf";
$url =~ s/<?.B>//g;

When you print out your link, use

Code:
<a href="$url">$rec{'Title'}</a>

That will get rid of your bold tags.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Wow, this can get frustrating. Ok. So I put the lines of code in that you suggested and now I get an error when trying to load the page. Please take a look at my html.pl as I had it set up before (still same setup, just updated with current file).

Eric
Quote Reply
Re: Fields are confused In reply to
Is the file at

www.icpc4cops.org/html_pl.txt

the same as the file you are getting the error with? I downloaded the file above and there was no syntax error in it.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Hmmm, yes same file. If you go to the login screen it will not load, instead it gives me a syntax error screen...??

I can't locate what it is talking about, but apparently there is something that it does not like???

Argh.

-E
Quote Reply
Re: Fields are confused In reply to
That's really odd.

Your script says

Quote:
Reason: syntax error at ./html.pl line 1210, near "sc ##
##########################################################

sub html_unkown_action "
syntax error at ./html.pl line 1243, near "}"
(Might be a runaway multi-line &#0124; &#0124; string starting on line 1236)

But there are only 1212 lines in the file you gave me and sub html_unkown_action is on line 1168. And there are no syntax errors. Try uploading your current html.pl file again to the

www.icpc4cops.org/html_pl.txt

location.


------------------
JPD





Quote Reply
Re: Fields are confused In reply to
Ok, I re-uploaded my html_pl.txt source to
http://www.icpc4cops.org/html_pl.txt

Yes, it is very odd. Go figure, we get so close and then a brick wall lands in front of us. =)

-E

------------------
Quote Reply
Re: Fields are confused In reply to
So, any ideas? All this help is VERY appreciated, not to mention the lesson in programming and debugging. =)


------------------
Quote Reply
Re: Fields are confused In reply to
Well, now everything loads. Cool. =)

One thing though, when a user goes to 'View' the 'Number' field now shows .pdf as default. Is there a way to not have this showing? Visit the database to see what I mean. P03 is the active document for the sample.

Thanks.
Quote Reply
Re: Fields are confused In reply to
I just logged onto your database, and all seems to be working fine. (aside from the fact that you don't have the files on your server as yet. Smile )



------------------
JPD





> >