Gossamer Forum
Home : Products : Links 2.0 : Customization :

Build turning id into NO or Yes

Quote Reply
Build turning id into NO or Yes
Hello,
I've looked this over and over and over until it's now 2:50 in the mornin, and Im just not seeing what's causing this problem.

Basically, I enter a test record, click on Build All, and it replaces the record id number in the database with either No or Yes.

Heres my links.def file, perhaps someone will spot something right away or try it on their test links systems to see if it happens to them as well, and help me to find out why.

Code:
# -------------
# Links
# -------------
# Links Manager
#
# File: links.def
# Description: Contains the database definition for links.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.0
#
# (c) 1998 Gossamer Threads Inc.
#
# This script is not freeware! Please read the README for full details
# on registration and terms of use.
# =====================================================================

# Database Definition: LINKS
# --------------------------------------------------------
# Definition of your database file.
%db_def = (
ID => [0, 'numer', 5, 8, 1, '', ''],
'Product ident' => [1, 'alpha', 15, 75, 1, '', ''],
Description => [2, 'alpha', '40x3', 900, 1, '', ''],
Qty => [3, 'numer', 10, 75, 1, '', ''],
'Qty On Hand' => [4, 'numer', 10, 75, 0, '', ''],
Date => [5, 'date', 15, 15, 0, \&get_date, ''],
'Exp Date' => [6, 'date', 15, 15, 0, \&get_date, ''],
Size => [7, 'alpha', 15, 50, 0, '0', ''],
'Brand Name' => [8, 'alpha', 35, 75, 0, '', ''],
Price => [9, 'numer', 10, 10, 1, 0, ''],
'Pallet Price' => [10, 'numer', 10, 10, 0, 0, ''],
'Sale Price' => [11, 'numer', 10, 10, 0, '', ''],
Master => [12, 'alpha', 25, 500, 0, '', ''],
'Case Pack' => [13, 'alpha', 25, 100, 0, '', ''],
Type => [14, 'alpha', 10, 15, 0, 'New', ''],
Category => [15, 'alpha', 0, 150, 1, '', ''],
Misc => [16, 'alpha', '40x3', 900, 0, '', '']
);

# Database file to use -- defined in links.cfg.
$db_file_name = $db_links_name;
# Counter file to use -- defined in links.cfg.
$db_id_file_name = $db_links_id_file_name;
# The column name for the database key.
$db_key = 'ID';
# Database delimeter.
$db_delim = '|';
# Title used in admin output.
$html_title = 'Product Database';
$html_object = 'Product';

# Field Number of some important fields. The number is from %db_def above
# where the first field equals 0.
$db_product_ident = 1; $db_date = 5; $db_exp_date = 6; $db_category = 15; $db_id = 0;
$db_description = 2; $db_id = 0;
$db_qty = 3;
$db_qty_on_hand = 4;

# Field number to sort links by:
$db_sort_links = 1;

# Field names you want to allow visitors to search on:
@search_fields = (5,10);

# System defaults. When adding new links or modifying links, these fields
# can not be overwritten by a user.
%add_system_fields = (
# isNew => 'No',
# isPopular => 'No',
# Hits => '0',
# Rating => 0,
# Votes => 0,
# ReceiveMail => 'Yes'
);

# Hash of column names to possible options. If you want to use a select form
# field, you can use &build_select_field in your HTML page. This routine will
# make a <SELECT> input tag using the following values:
%db_select_fields = (
# isNew => 'Yes,No',
# isPopular => 'Yes,No',
# ReceiveMail => 'Yes,No',
Type => 'New,Refurbished,Short Date'

);

# Hash of column names to radio values. If you use &build_radio_field, it will
# make a <INPUT TYPE="RADIO"> tag for you using the options specified in the hash.
%db_radio_fields = ( );

# Maximum number of hits returned in a search. Can be overridden in the search
# options.
$db_max_hits = 10;

# Use the built in key tracker.
$db_key_track = 1;

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
@db_cols = ();
foreach (sort { $db_def{$a}[0] <=> $db_def{$b}[0] } keys %db_def) {
push (@db_cols, $_);
$db_sort{$_} = $db_def{$_}[1];
$db_form_len{$_} = $db_def{$_}[2];
$db_lengths{$_} = $db_def{$_}[3];
$db_not_null{$_} = $db_def{$_}[4];
$db_defaults{$_} = $db_def{$_}[5];
$db_valid_types{$_} = $db_def{$_}[6];
($_ eq $db_key) and $db_key_pos = $db_def{$_}[0];
}

1;
[\code]

Thanks
Vis

[This message has been edited by Visionary (edited December 16, 1999).]
Quote Reply
Re: Build turning id into NO or Yes In reply to
One possible problem is that you have $db_id listed twice in the Important Field Section.

Hope this helps.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Build turning id into NO or Yes In reply to
Thanks again Eliot,
Removed the extra $db_id = 0; from the def file, and still writes No to the links.db file after a build all, or a staggered build. So there must be something else in the def file that I've modified and messed up somehow, but I just don't see it.

I've even tried going back to the original def file, and adding in from scratch, and still get that.

Im wondering if the fields that Alex has put in the original def file have to be in there else, it will do this kind of wonder.

Anyone else have a crack at it?

Thanks
Vis
Quote Reply
Re: Build turning id into NO or Yes In reply to
The problem is that you have added a new field in your db_def section of your links.cfg file and you have NOT added the new field into your existing database.

You need to use the script written by Bobsie. Search this forum for "upgrade.pl".

BTW: This has been discussed more than once in both this forum and the Discussion Forum.

Wink

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Build turning id into NO or Yes In reply to
Thanks Eliot,
Actually, we are starting with a clean empty links.db file, so adding another field before adding any data to the links.db file really shouldn't require using the upgrade script to add new fields into the links.db file since theres nothing in there to begin with.

Any thing else I should be looking at?
Vis
Quote Reply
Re: Build turning id into NO or Yes In reply to
I would recommend taking out the isNew and other fields in the db_select_fields and db_radio_field stuff rather than just remming out those code lines.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Build turning id into NO or Yes In reply to
Yup, did that, no good, ID still gets changed to No, when ever you rebuild.

AAAAAALLLLLLLLEEEEEEXXXXXX, any suggestions, Im having a terrible time with this, it's always been so simple, and I'm sure it's simple this time, just probably overlooking something here, but I'm apparently too blind to see it.

Help please Alex, you know this better than anyone, if you can't see it, nobody can.

Vis
Quote Reply
Re: Build turning id into NO or Yes In reply to
Thanks for the note of confidence of other LINKS users...

Wink

One other thing I would check is your linksid.txt file and make sure it is empty.

Other than that...I don't know what to say.

Regards.

------------------
Eliot Lee
Anthro TECH,L.L.C
www.anthrotech.com
----------------------


Quote Reply
Re: Build turning id into NO or Yes In reply to
Sorry Eliot, it wasn't a vote of lack of confidence of other links users, you guys and gals are the bomb, it's just that this site was supposed to be finished by tommorrow, friday, and while the actual site is finished, this database crunch is holding us up from finishing the complete job, hence we don't get paid for the job, and Gossamer-Threads doens't get paid for the database, so I was just hoping that Alex could take a few minutes of his busy schedule and have a looksee, and see what's up with what we screwed up.

No offense was intended, just needing to have it done, xmas shopping and all, money is scarce for us designers this time of year and every job we get, we want to keep.

Thanks for the help, by the way nope, linksid.txt didn't help, done that already, Im pretty sure it must have something to do with fields that must be in a database and some hard coding in the scripts somewhere when building, but I can't find it.

A desperate cry for help.

Vis
Quote Reply
Re: Build turning id into NO or Yes In reply to
Visionary

I had the same problem, and just fixed it!

You have to make sure that you don't remove
the items for Hits, isPopular and isNew
from the links.def file.

Good luck...

E-mail me if you need more info.
mail@ewd.net

Michael
Quote Reply
Re: Build turning id into NO or Yes In reply to
Does anyone know whether or not Links 2.0 has to have some of the fields that already exist in the stock links.def to function properly, for example, title, url, is new etc. etc. etc.

What we have experimented with, is to take a fresh copy of links.def and add on all the fields that we need in it, then we test it, everything is right as rain, then we remove one by one the fields that we don't need, renumbering the fields in all sections of links.def and try again, then the id field gets renamed to No after a rebuild, which leads me to believe that Links 2.0 requires that some of the fields that come stock in links 2.0 are required. So, how do I modify the build all script so that it stops writing No to the id field in the database when building all the pages?

Still looking for an answer as I think being able to remove fields now in the system opens up whole new doors for this product to be used as so much more than a links system, like a product catalog, doctors database, etc. etc . etc.

Your time and help appreciated.
Vis
Quote Reply
Re: Build turning id into NO or Yes In reply to
Thanks Websolve, will definately give it a try and leave those in there.

Vis
Quote Reply
Re: Build turning id into NO or Yes In reply to
Yup, that did it, thanks websolve, i can live with only those three fields remaining, and the capability to adjust the rest.
Quote Reply
Re: Build turning id into NO or Yes In reply to
I've been strugging with this problem myself, and I also would like to know if there is any way to delete those (apparently) required fields. Anyone have more input on this?

Thanks,

Jeff
Quote Reply
Re: Build turning id into NO or Yes In reply to
you didn't get rid of your new and popular stuff from nph-build.cgi

that's all i will say.. i hope someone else will tell you what to do.. i have had no time lately to do anything

------------------
Jerry Su
Links SQL User
------------------