Menu

Creating a database Log in to Edit

Creating a database

Typical steps in creating a database using WODA are as follows (or better still, simply copy and edit one of the DemoFiles you installed): Create a data definition file in the cgi-directory that has at least these lines (subject to you installation settings):

#!/usr/bin/perl

require '/usr/local/woda/en/woda.pl';

$WBF{name}='1;';

do main();

Then, mark the file as executable, using your ftp program or the command line:

chmod +x the_file

This will create an application and a Web service that would handle a database with a single field called name. Need more fields? Need more features? There are hundreds of other setting you may wish to define just above do main() row. Settings are divided in two hashs: '%WBB' and '%WBF'. These hashs will contains '$WBB' or '$WBF' parameters. '$WBB' parameters are for the database settings, while '$WBF' parameters are for the fields (think of them like WBBase and WBField). Like in this sample:

#!/usr/bin/perl

require '/usr/local/woda/en/woda.pl';

$WBB{'dbTitle'} = 'name of my database';
$WBB{'manager'} = 'my name'; 
$WBB{'managerEmail'} = 'myEmail@mydomain.com';

$WBF{name}='1;'; 
$WBF{name,type}='INPUT'; 
$WBF{name,typePar}='size=15';

$WBF{phone}='1;'; 
$WBF{phone,type}='INPUT'; 
$WBF{name,typePar}='size=10';

do main();

Database creation tips

  • Field names can be any length and can include letters and digits. Field names should not start with an _ and should not include spaces since a few system defined fields do.
  • Each field must have a validation expression. If you don't want to validate the filed the expression should be 1; . See help on LogicalExpressions.
  • The order in which the fields are defined is the same as the order in which the fields will be displayed, whenever an order is required.

Creating a database from sample data

A quick way to create a first draft of the database is to use the “Create from Data” option in the Administration menu:

  1. Prepare the data into a .CSV file using spreadsheet software like LibreOffice Calc or Ms Excel, or export datas from FileMaker, Ms Access, LibreOffice Base
  2. Fill out the form
  3. Voila, database is ready for first use -- if the Web server was allowed to create all required files and directories.
  4. Refine the database using ModifyStructure menu

Importing data into a database

import in Woda

You can import data from a .CSV file which can be created by software like Excel or Access. The fields in this format are delimited with semicolon or comma. If a field contains new-line, semicolon or a double-quote ("), fields are quoted in double quotes and each double-quote is replaced by two double-quotes. Import only happens if all records pass all controls defined.


Related

Documentation Wiki: AdministratorManual
Documentation Wiki: Home