HowTo make a new database in split format
| This document describes how to make a new database in TB Wiki. | This document describes how to make a new database in TB Wiki. |
| TB Wiki was designed specifically to make this as easy as possible, usingregular wiki files as the records for the database. This page is intendedto be a quickstart guide to setting up a simple database. For completedocumentation, see DocTables | TB Wiki was designed specifically to make this as easy as possible, usingregular wiki files as the records for the database. This page is intendedto be a quickstart guide to setting up a simple database. For completedocumentation, see [[DocTables]] |
Table Type [edit section] | == Table Type ==First, determine the table type - single file or multi-file. |
| You can edit the database in a single file, or have a database consist ofmultiple files. If the records are large, and have lots of free-form text,it is usually better to put them into separate files. | You can edit the database in a single file, or have a database consist ofmultiple 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] | == single-file ==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||} }}}}} |
like so:{{{{{{!Table:contacts||name||address||phone||||Tim||123 Main St.||555-5555||||Frank||456 State Ave.||666-6666||} }}}}}
|
multi-file [edit section] | === multi-file ===For a multi-file database, you need to decide on a page prefix to usefor the data files. Each record of the database will reside on it'sown page in the wiki, and you can use a Table processor to collectthem 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 databasein TB wiki name-attr format (these are referred to as attribute files). |
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 databasein TB wiki name-attr format (these are referred to as attribute files).
|
| The following files might be defined: | The following files might be defined: |
| "contact_1" would have the following content:{{{record=1name=Timaddress=123 Main St.phone=555-5555description="""you could puta mult-line description here"""}}} |
"contact_1" would have the following content:{{{record=1name=Timaddress=123 Main St.phone=555-5555description="""you could puta mult-line description here"""}}}
|
| "contact_2" would have the following content:{{{record=2name=Frankaddress=456 State Ave.phone=666-6666}}} |
"contact_2" would have the following content:{{{record=2name=Frankaddress=456 State Ave.phone=666-6666}}}
|
|
Note that not every record needs to define every field | ''Note that not every record needs to define every field'' |
| Then, create a separate page to have a view of the table, like so: | Then, create a separate page to have a view of the table, like so: |
| "Contacts", would have the following content:{{{{{{!Table:contactssource_spec=contact_.*cols=record_id:name:address:phone:descriptionsortby=name:alpha} }}}}} |
"Contacts", would have the following content:{{{{{{!Table:contactssource_spec=contact_.*cols=record_id:name:address:phone:descriptionsortby=name:alpha} }}}}}
|