This page follows on from database example page.
I found some data, in order to get it into the database I first edited it so that it is in CSV (Comma Separated Variable) format.
I have put a copy here: nutrition.csv
This is a text format where each field is in quotes and separated by commas. Each entry is on a separate line.

First I started OpenOffice.org Calc program and opened the CSV file, this brings up the following dialog box:
This should be set to separate with comma, then press OK, then select all the elements we want to include in the database, press edit->copy or control-c to copy to clipboard.

Leave the Calc program (don't exit) and start Open Office.org Base program. This brings up the following Wizard:

Leave set to "Create a new database" and click on next:

Leave the above default values and click on finish:

Enter name of database and click on OK which brings up the following screen:

In the Database pane click on 'Tables':

Click on the Tables pane and while the cursor is in the Tables pane type control-v. this brings up the following

Set the table name and also set 'Create primary key' then press next

Click on '>>' to select all columns and click on next:

I modified the length of type, barcode and hydrodised to 50.
The fields energykj, energykc, protein, carb, sugar, fat, saturates, fibre and sodium to:
| Field Type | Double |
| Length | 17 |
| Decimal Places | 0 |
I could not change the Decimal places from 0, I assume this allows any value.
Clicking on Create shows the byWeightQuantities table:

The Calc program can now be exited leaving the base program loaded with the data.
Next stage - go on to: Setting up a form
Other sections are:
Data:
|
metadata block |
|
| see also: |
|
| Correspondence about this page | |
This site may have errors. Don't use for critical systems.
Copyright (c) 1998-2023 Martin John Baker - All rights reserved - privacy policy.