HowTo_make_a_new_database 

TB Wiki

Login

HowTo make a new database

This document describes how to make a new database in TB Wiki.

TB Wiki was designed specifically to make this as easy as possible, using regular wiki files as the records for the database. This page is intended to be a quickstart guide to setting up a simple database. For complete documentation, see DocTables

Table Type [edit section]

First, determine the table type - single file or multi-file.

You can edit the database in a single file, or have a database consist of multiple files. If the records are large, and have lots of free-form text, it is usually better to put them into separate files.

single-file [edit section]

For a single file database, just create a page to hold the table of data, and start a table in TB wiki inline table format:

like so:

{{{!Table:contacts
||name||address||phone||
||Tim||123 Main St.||555-5555||
||Frank||456 State Ave.||666-6666||
} }}

multi-file [edit section]

For a multi-file database, you need to decide on a page prefix to use for the data files. Each record of the database will reside on it's own page in the wiki, and you can use a Table processor to collect them into a view of the data.

Let's say you create a contacts database, and use "contacts_" as the file prefix. Specify this with a "source_spec=contacts_.*" (Note the '.' in the wildcard for the page name) Each file in the database has a single record from the database in TB wiki name-attr format (these are referred to as attribute files).

The following files might be defined:

"contact_1" would have the following content:

record=1
name=Tim
address=123 Main St.
phone=555-5555
description="""you could put
a mult-line description here"""

"contact_2" would have the following content:

record=2
name=Frank
address=456 State Ave.
phone=666-6666

Note that not every record needs to define every field

Then, create a separate page to have a view of the table, like so:

"Contacts", would have the following content:

{{{!Table:contacts
source_spec=contact_.*
cols=record_id:name:address:phone:description
sortby=name:alpha
} }}

TBWiki engine 1.9.1 by Tim Bird