WODA: FAQs

 Related Files

Is it possible to link databases?

In order to use data from another WODA database (table), you must "declare"
the table(s) with a $WBB statement like this:

$WBB{'tables'} = 'sector /cgi-bin/sector.cgi
/Xitami/webpages/woda/data/sector';

To use multiple tables, follow the same format, creating a new line for each
seprate table and using TAB as a seprator:

$WBB{'tables'} = 'sector /cgi-bin/sector.cgi
/Xitami/webpages/woda/data/sector
foo /cgi-bin/foo.cgi /Xitami/webpages/woda/data/foo
';

The $WBF for the first example could look something like this:

$x='sector'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x,'p'} = 'Select the sector(s) you are working with.';
$WBF{$x} = '1;';
$WBF{$x,'type'} = 'LINKOPTION';
$WBF{$x,'typePar'} = 'TREE MULTIPLE CHECKBOX';
$WBF{$x,'into'} = 'sector';
$WBF{$x,'picture'} = '&ROWS ("sector","sector")';

When one goes to enter data, in the above example, there are check-boxes on
the screen containing data from the foreign "sector" table. Notice the last
line - ("sector","sector"). The first "sector" points to the table alias
"sector" (delcared by $WBB) and the second "sector" points to field "sector"
from table alias "sector" the syntax for this construction is as follows:

$WBF{$x,'picture'} = '&ROWS ("alias","field","field" . . .)';



In your user registration system, you could implement something such as
this, where dbs is a list of WODA databases:

#!/perl/bin/perl

require "/woda/woda-uk.pl" unless defined &main;

#
# Database definition:
#

$WBB{'dbTitle'} = 'Database Users';
$WBB{'about'} = 'This database provides user registration for other WODA
applications.';
$WBB{'recordTitle'} = 'Personal data';
$WBB{'language'} = 'uk';
$WBB{'pageBody'} = 'BGCOLOR="#E0E0E0"';
$WBB{'manager'} = 'Admininstrator';
$WBB{'managerEmail'} = 'root@localhost';
$WBB{'dataDir'} = '/Xitami/webpages/woda/data/user';
$WBB{'homeURL'} = '/woda/data/user';
$WBB{'sort;DEFAULT'} = '"$rec{lastName};$rec{firstName}"';
$WBB{'formatRowDEFAULT'} = '$rec{homePage} ?
"<A HREF=$rec{homePage}>$rec{firstName} <B>$rec{lastName}</B></A> (<A
HREF=mailto:$rec{email}>$rec{email}</A>)
$rec{dbs}"
:
"$rec{firstName} <B>$rec{lastName}</B> (<A
HREF=mailto:$rec{email}>$rec{email}</A>)$rec{dbs}"';
$WBB{'key'} = '"$rec{username}"';

$WBB{'tables'} = 'dbs /cgi-bin/dbs.cgi /Xitami/webpages/woda/data/dbs';

#
# Field definitions:
#

$i=1000; # counter




$x='title'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = '1;';
$WBF{$x,'type'} = 'OPTION';
$WBF{$x,'typePar'} = 'RADIO';
$WBF{$x,'options'} = 'Mr.|Mrs.|Ms.|Miss|M.S.|Dr.';

$x='firstName'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = 'm/[A-Za-z\-\. ]{1,40}/';
$WBF{$x,'cond'} = '1-40 US letters, dots and dashes!';
$WBF{$x,'help'} = 'Enter the first name followed by any middle initials e.g.
<I>John F.</I>';
$WBF{$x,'picture'} = '"<BIG>$_</BIG>"';

$x='lastName'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = 'm/[A-Za-z\-]{1,40}/';
$WBF{$x,'cond'} = '1-40 US letters, dots and dashes!';
$WBF{$x,'help'} = 'Enter last name. If You have two, separate them with a
dash e.g. <I>Martin-Smith</I>';
$WBF{$x,'picture'} = '"<BIG>$_</BIG>"';

$x='username'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x,'p'} = 'Username';
$WBF{$x} = 'm/[a-z]{2,8}/';
$WBF{$x,'cond'} = '2-8 small US leters';
$WBF{$x,'typePar'} = 'SIZE=8';
$WBF{$x,'help'} = 'Enter your username.';

$x='dbs'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x,'p'} = 'Select the sector(s) you are working with.';
$WBF{$x} = '1;';
$WBF{$x,'type'} = 'LINKOPTION';
$WBF{$x,'typePar'} = 'TREE MULTIPLE CHECKBOX';
$WBF{$x,'into'} = 'dbs';
$WBF{$x,'picture'} = '&ROWS ("dbs","dbs")';

$x='picture'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = 'm/gif$|jpg$|^$/';
$WBF{$x,'type'} = 'IMAGE';
$WBF{$x,'help'} = 'Adding an image is optional. But if you have one, upload
it!';

$x='about'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = '1;';
$WBF{$x,'type'} = 'TEXTAREA';
$WBF{$x,'typePar'} = 'ROWS=5 COLS=60';
$WBF{$x,'p'} = 'Tell us more about yourself!';

$x='email'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = '1';
$WBF{$x,'d'} = 'info@integrated-training.com';
$WBF{$x,'type'} = 'EMAIL';
$WBF{$x,'sticky'} = '1';
$WBF{$x,'help'} = 'Enter your email address.';

$x='homePage'; # ------------------------------
$WBF{$x,srt}=$i--;
$WBF{$x} = '1;';
$WBF{$x,'type'} = 'URL';
$WBF{$x,'help'} = 'If you have a home page, enter it here.';

# --------

do main();





I hope this puts you on the right path.

-=Sean Edwards=-

modify the informationdelete entire recordexplain the meaning of the fieldsbrowse recordsAdd a new questionHome page of this databaselogin Valid HTML 4.01 Transitional Valid CSS! Powered by WODA 4.6x trunk