Gossamer Forum
Home : Products : DBMan : Customization :

Skip Blank Field...But the Last Field is not Skipped

Quote Reply
Skip Blank Field...But the Last Field is not Skipped
OK, I''ve got this dbman setup of mine working quite well now. I have set it to skip blank fields which takes up much less space when viewing the records. But there seems to be some problem with the last field in each record. Even if this field is blank it still prints a line for it when viewing. Can anyone help with this?

And thanks again to whoever put the configurator back on-line. This makes using dbman so much easier.
Quote Reply
Re: [Bill Tillman] Skip Blank Field...But the Last Field is not Skipped In reply to
I'm not sure anyone can help without seeing that portion of the coding for your display :)

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Skip Blank Field...But the Last Field is not Skipped In reply to
I'm not sure how to show the code here but lets see if I can explain in more detail.

I have a database that consists of 18 fields. I have set the option to not print fields if they are blank. So lets say that all the fields in one of of the records except #10, #13 and #18 have data in them, that is these three fields are blank. The record in the database would look something like this:

1|2|3|4|5|6|7|8|9||11|12||14|15|16|17|

When I view this record, there is no line item for field #10 and #13, which is good because those fields are blank. But there is a line item for field #18 and it just shows the field name along with a blank space where the data would normally appear. I was assuming that this field would not appear when the record is printed like the others. But on each and every record that's viewed, the last field shows up whether it's blank or not.

I used the configurator at JBDeni's website to assist in the building of html.pl. This is not that big of a deal, the records still view as needed, but it would be nice if the all blank fields were omitted especially as the number of records begins to grow. Viewing blank fields only takes up space that could otherwise be used on the webpage view.
Quote Reply
Re: [Bill Tillman] Skip Blank Field...But the Last Field is not Skipped In reply to
Post your db.cfg file -- I'm wondering if there's an issue with field numbers (?) -- you can omit the directory paths if you'd rather not have that info publicized.
Quote Reply
Re: [Watts] Skip Blank Field...But the Last Field is not Skipped In reply to
# ----------------------
# DBMan
# ----------------------
# Database Administrator
#
# File: default.cfg
# Description: This is the setup file that contains the database definition,
# and most of the options required to set the program up.
# Author: Alex Krohn
# Email: alex@gossamer-threads.com
# Web: http://www.gossamer-threads.com/
# Version: 2.04
#
# COPYRIGHT NOTICE:
#
# Copyright 1997 Gossamer Threads Inc. All Rights Reserved.
#
# This program is being distributed as shareware. It may be used and
# modified free of charge for personal, academic, government or non-profit
# use, so long as this copyright notice and the header above remain intact.
# Any commercial use should be registered. Please also send me an email,
# and let me know where you are using this script. By using this program
# you agree to indemnify Gossamer Threads Inc. from any liability.
#
# Selling the code for this program without prior written consent is
# expressly forbidden. Obtain permission before redistributing this
# program over the Internet or in any other medium. In all cases
# copyright and header must remain intact.
#
# Please check the README file for full details on registration.
# =====================================================================
# File and URL's
# --------------------------------------------------------
# URL of the directory dbman resides in. No Trailing Slash Please.
$db_dir_url = "http://www.mywebsite.com/cgi-bin/joblogs";
# URL of dbman.
$db_script_url = $db_dir_url . "/db.cgi";
# Full Path and File name of the database file.
$db_file_name = $db_script_path . "/default.db";
# Full path and file name of the counter file.
$db_id_file_name = $db_script_path . "/default.count";
# Full path and file name of the authorization directory.
$auth_dir = $db_script_path . "/auth";
# Full path and file name of the password file.
$auth_pw_file = $db_script_path . "/default.pass";
# Full path and file name of the log file.
$auth_log_file = $db_script_path . "/default.log";
# Full path and file name of the html routines.
require $db_script_path . "/html.pl";
# Database Definition
# --------------------------------------------------------
# Definition of your database. Format is
# field_name => ['position', 'field_type', 'form-length', 'maxlength', 'not_null', 'default', 'valid_expr']
%db_def = (
'ID' => [ 0, 'numer', 20, 255, 1, '', ''],
'Date' => [ 1, 'date', 20, 255, 1, &get_date(), ''],
'Day' => [ 2, 'alpha', 0, 3, 1, '', ''],
'JobName' => [ 3, 'alpha', 33, 255, 1, '', ''],
'JobNo' => [ 4, 'alpha', 6, 6, 1, '', ''],
'Contractor' => [ 5, 'alpha', 33, 255, 1, '', ''],
'Weather' => [ 6, 'alpha', 0, 8, 1, 'Clear', ''],
'Temp' => [ 7, 'numer', 3, 3, 0, '', ''],
'Activities' => [ 8, 'alpha', '40x6', 5000, 1, '', ''],
'Equipment' => [ 9, 'alpha', '40x6', 5000, 0, '', ''],
'Laborer' => [10, 'numer', 3, 3, 0, '', ''],
'Driver' => [11, 'numer', 3, 3, 0, '', ''],
'Glazier' => [12, 'numer', 3, 3, 0, '', ''],
'Jorneyman' => [13, 'numer', 3, 3, 0, '', ''],
'Foreman' => [14, 'numer', 3, 3, 0, '', ''],
'Super' => [15, 'numer', 3, 3, 0, '', ''],
'PM' => [16, 'numer', 3, 3, 0, '', ''],
'ExtraWk' => [17, 'alpha', '40x6', 5000, 0, '', ''],
'Notes' => [18, 'alpha', '40x6', 5000, 0, '', '']
);
# The column name for the database key. Can be any column, but it must be unique!
# You can't have two records with the same key value!
$db_key = 'ID';
# Track the key? Should DBMan keep a counter of the next key to use? This isn't
# neccessary if you can guarantee that your entry in the key field will be unique
# (i.e. a userid).
$db_key_track = 1;
# Database delimeter.
$db_delim = '|';
# Use file locking (1 = Yes, 0 = No). Should be used, but won't work on Win95.
$db_use_flock = 1;
# Auto generate the html forms (1 = Yes, 0 = No).
$db_auto_generate = 0;
# Display Benchmarking Information (1 = Yes, 0 = No).
# use Benchmark; # Uncomment this line if benchmarking is used.
$db_benchmark = 0;
# Display Debugging Information (1 = Yes, 0 = No).
$db_debug = 0;
# Select fields. Field name => 'comma seperated list of drop down options'.
%db_select_fields = (
'Day' => 'Sun,Mon,Tue,Wed,Thu,Fri,Sat',
'Weather' => 'Clear,Cloudy,Showers,Rain Out'
);
# Radio fields. Field name => comma seperated list of radio buttons.
%db_radio_fields = (
);
# Checkbox fields. Field name => Checkbox value.
%db_checkbox_fields = (
);
# Default maximum number of hits returned in a search.
$db_max_hits = 10;
# Bold search results (1 = Yes, 0 = No).
$db_bold = 1;
# Regular and title fonts used in auto_generation and html.pl.
$font = 'font face="verdana,arial,helvetica" size="2"';
$font_title = 'font face="verdana,arial,helvetica" size="4"';
# Authorization Options
# --------------------------------------------------------
# No Authentication? (1 = "there is no authentication", 0 = "there is authentication")
# If you choose no authentication, then set the permissions of what
# people can do with: @auth_default_permissions below.
$auth_no_authentication = 0;
# The amount of time in seconds that user files are kept in the
# auth directory before the program removes them. 2-6 hours is
# probably a good value.
$auth_time = 21600; # 6 hours (in seconds)
# Enable (1) or disable (0) logging.
$auth_logging = 1;
# Allow a default user? This means you can specify a user via the URL
# and skip the logon process. Use this to allow people to search without
# logging on, but require log in if they want to add/modify/remove etc.
# (1 = "yes", 0 = "no")
$auth_allow_default = 1;
# Default permissions used if there is no authentication, or for a default
# user. (View, Add, Delete, Modify, Admin), 1 = enable, 0 = disable.
@auth_default_permissions = (1,0,0,0,0);
# Allow people to sign up for their own userid/passwords? They will
# recieve default permissions.
$auth_signup = 1;
# Permissions a new signup should get.
@auth_signup_permissions = (1,0,0,0,0);
# Registered users: can modify/delete _only_ own records. For this to make
# sense you should set default off or to 1,0,0,0.
$auth_modify_own = 0;
# Registered users: can view _only_ own records. For this to make sense
# you should turn off default permissions.
$auth_view_own = 0;
# Auth user field. This is the field position in the database used for storing
# the userid who owns the record. Set to -1 if not used.
$auth_user_field = -1;
# URL to send user if they chose log off. Leave blank and the script will return to
# the logon prompt (although this only makes sense if you are using authentication).
$auth_logoff = "http://www.mywebsite.com/cgi-bin/joblogs/db.cgi";

# ===========================================================================
# Build up some variables from your definitions. Internal use only.
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;
Quote Reply
Re: [Bill Tillman] Skip Blank Field...But the Last Field is not Skipped In reply to
Didn't spot anything there... I was suspicious that maybe the fields were numbered wrong, but that's not the case... hmm...
Quote Reply
Re: [Watts] Skip Blank Field...But the Last Field is not Skipped In reply to
looks like autogenerate is turned off so you need if field not blank statements in your html.pl file.