Writing a Front End for Claims_DB Part 1 - Introduction

This content was originally published to benscomputer.no-ip.org

This tutorial is intended to show the reader how to create a simple user interface for Claims_DB. We will be creating a frontend for a sample database. The end result will comprise of a set of CGI scripts, which will process input from forms and pass the relevant requests onto Claims_DB itself.

A word of warning, the system is still under heavy development, so writing any sort of front-end is not for the faint hearted, it's not especially complicated, but you currently need to do quite a bit of the processing and parsing from within the front end.

Certain functionalities will be added in the next release, so some of the methods shown here (creating an autonumber for example) will become outdated. They will still work, but will be superseded by a more appropriate method.


The first thing we need to do is to create our Database, Claims_DB currently lacks an 'add database' functionality, so there is a bit of manual work to be done. First lets grab an existing table - Motorcycle parts listing You can find that here.

This table is provided as part of the sample database, but we'll treat it as though we are starting from scratch.

Change into the db folder within the Claims_DB folder, and create a folder called Sample_DB

mkdir Sample_DB

This is our main database root, now copy Catalogue.csv into this folder.

Next we need to register the new database within Claims_DB so move back to the parent directory and enter the folder called Databases

cd Databases

Now open the file Databases.csv in your favourite text editor;

nano Databases.csv

and add the following line


The number 4 is the database ID, as logn as it is unique it doesn't matter which number is set. The reason we are using 4 is because I already have 3 other databases. Sample_DB is the name of the database (This must match the folder name, and is case sensitive). There will eventually be a tool to automate this process!

Now that the database is registered, we can move on. However, to protect future functionality (i.e. not necessary at the moment, but may be in the future) we should register the table and the columns of the database, so add the following to Tables.csv


4 defines the database, Table states that the element is a table (In case this table is used for forms, reports and queries in the future), 7 is a unique identifier for the table, and Catalogue is the table name.

To define the Columns, we open the file Elements.csv and add the following lines

7,"Part Location",3
7,"Part Number",4
7,"Number Type",5
7,"Qty in Pack",7
7,"Qty on Bike",8

Updating these two files is not absolutely necessary, but it can make your life easier in the future. The Elements table can be especially helpful to use as a reference when writing Queries and Reports.

OK, so the database is prepared, we now need to write the front end.

Writing a front-end to Claims_DB Part 2