Using Glom as a Developer

When you create a new document, Glom will be in the Developer user level. You can also change to the Developer user level after opening an existing document, with the User Level menu. Glom will only allow this if the administrator has allowed it.

4.1. Adding Tables

You can see the list of existing tables by choosing Tables from the Navigate menu. You will also see this window after connecting to a database server, after creating a new document. To create a new table, click the Add button and enter the name for the new table. Glom will suggest a human-readable title for this table. Operators will see this title instead of the actual table name. You can also mark a tables as hidden from Operators. For instance, Operators should see "Invoice Lines" as related records from the "Invoices" table, but they should never be able to navigate directly to the "Invoice Lines" table.

You can also specify one table as the default table. This table will be shown whenever an operator opens an existing document, without asking him to select a table from the list.

You can also use this window to rename an existing table.

Click the Open button to look at the selected table.

4.2. Editing Fields

Choose Fields from the Developer menu. This shows the list of fields in the table. New tables automatically have a primary key field, but you can change this field if necessary.

Click the Add button to add a new field, then enter the name of the new field. Glom will guess an appropriate human-readable title for this field, but you can edit this. Operators will see this title instead of the actual field name.

To specify more field details, select the field and click the Details button.

Figure 7Editing Fields

4.2.1. Primary Keys

Each table must have one, and only one, Primary Key. The value in this field will be unique, meaning that each value in this field will appear in only one record in the table. For instance, each record in a "Customers" table would have a "Customer ID". This value will be used to refer to that customer from other tables, such as "Projects" and "Invoices" records. See the Creating Relationships section to see how you can relate tables together.

4.2.2. Field Types

Glom offers a few simple field types:

  1. Number

  2. Text

  3. Date

  4. Time

  5. Boolean - either true or false

  6. Image

4.2.3. Calculated Fields

Field values can be calculated in terms of other fields, using the Python programming language. This calculation should be the implementation of a python function, which should return a value. The return value will be used as the value of the field. This value will be recalculated every time one of the source fields changes. TODO: This only works for default values at the moment, and you can not use field values in the calculation yet.

You can also use calculations to specify a default value for fields, by selecting the Default Value tab in the Field Details window, clicking on the Calculate Value check box, and then entering a Python calculation. You can test this calculation in the Edit window.

4.3. Arranging Layouts

Each table has List and Details views, and by default these show all fields in the table, in order of creation. You can edit the layout by choosing Layout from the Developer menu.

4.3.1. Arranging the List View

For the List view, you can specify the sequence of field columns, and whether some fields are hidden.

Figure 8Editing the List Layout

4.3.2. Arranging the Details View

For the Details view, you can create groups of fields, and give these groups titles. You can then place fields in these groups and specify the sequence fo fields in these groups. You can also specify the sequence of these groups. For instance, in a "Contacts" table, you might create a "Name" group, and place the "title", "first_name" and "last_name" fields in that group. You might have other groups for the "Address" fields.

Figure 9Editing the details Layout

4.4. Creating Relationships

Tables in the Database are often related together. For instance, an "Invoices" table might have a "Customer ID" field. A value in this field would specify a record in the "Customers" table with the same value. Glom can show extra information, such as the customer name, from that related record. Or it can show a list of several related records - for instance, several related "Invoice Lines" that are related to a record in the "Invoice" record.

To create relationships, choose Relationships from the Developer menu. This will show the list of existing relationships. Click the Add button to create a new relationship, and enter a name for it. You should then choose a field in the current table, and a field in another table to which it should be related. This relationship will find any records in the other table for which the values in both fields are equal.

You can use the relationship in the following places.

  1. To show a related field on the List or Details view.

  2. To show a list of related records on the Details view.

  3. To lookup a value from a field in a related record. For instance, to copy the current price of a "Product" into the "Price" field of an "Invoice Line" record.

  4. To calculate a field value.

4.5. Users Administration

To define the Operators who can use your database, and to specify what access they have to the various tables, choose Users from the Developer menu.

4.6. Translations

Glom's user interface (and this document) is translated into several languages, as you should see already if you are using your computer with a non-English user interface. In addition, Glom automatically shows and understands numbers and dates according to the current user's local conventions. For instance, a user in the USA might enter a price as 1.99 and a date as 1/13/2008, but a German user of the same database will later see that as 1,99 and 13.1.2008.

However, the Glom system that you create also contains text that must be translated if it will be used by people who speak different languages. For instance, you must provide translations for the titles of your tables, fields, and reports. All of these text items can be seen in a list when you choose Translations from the Developer menu. In this window you can specify the language that you used for the original text, and enter translations for each text item for additional languages. When the Glom system is opened by a user of that language then these text items will be shown in the user interface.

Figure 10Translations

Experienced translators may be more familiar with the .po file format, or you might wish to use the many tools that work with the .po file format. By using the Export button you can create a .po file to use in a separate tool or to send to a translator. You can then import the resulting translation by using the Import button.

4.7. Defining Reports

4.7.1. Adding or Editing Reports

Glom can produce reports to show specific fields for sets of records, sorted and grouped. For instance, a shop might need a report listing all products sold in one month, grouped by product type, and sorted by price inside each group. Each table has its own reports, which are available to the operator from the Reports menu.

To define a report, or to change the definition of an existing report, choose Reports from the Developer menu.

Figure 11Creating or Editing Reports

Notice that each report has an ID as well as a human-readable name. This allows your report to have a translated title when used on a computer that uses a different language.

4.7.2. Editing a Report

A Glom report has three areas:

  1. The Header, which appears at the start of the report

  2. The Main area, in which the records and summary lines are shown, with the actual data from the database.

  3. The Footer, which appears at the end of the report.

Inside an area, such as the Main part, you may add report Parts, such as fields, text, or images. These will usually appear in a row on the printed report, with one row for each record. In the simple case, this will look much like Glom's list view. You can add parts to your report by selecting them from the Available Parts list and then clicking the Add button. The part will then be added to the Parts list, in the selected area.

To specify details for the parts, such as the text or image to display, or to choose the field to display, select the part in the Parts list and click the Edit button. You may also specify field formatting by clicking the Formatting button, just as you would when defining a details or list layout.

Figure 12Editing a Report

Some parts may contain other parts and have extra properties to control how they present their child parts. For instance, the Group By part groups records together by a field. For instance, a products report might group a list of products by product type. You can even add a second sub-grouping inside the main Group By part, by selecting your top-level Group By part in the Parts list while adding a new Group By part from the Available Parts list. For instance, you might group your products by manufacturer, inside each product type group.

To specify the field by which the records should be grouped, select your Group By part in the Parts list and click the Edit button. You can then choose the field by which the records should be grouped, and select the fields by which these records should be sorted within the group. You may also specify some additional fields to be displayed in the group's title row. For instance, you might want to group products by a manufacturer ID, but also show the manufacturer name.

Figure 13Editing a Group By Part

The Vertical Group part may contain other items. For instance, it allows you to arrange fields below each other instead of just one after the other in the horizontal row. This is useful for grouping related fields such as address lines, or just to squeeze more information into the records's row on the report.

Figure 14A Report with Vertical Groups

When you have finished, click the Close button to save the report's definition. Your report can then be chosen from the Reports menu. See the Printing Reports section for more details.