<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY legal SYSTEM "legal.xml">
<!ENTITY appversion "1.6">
<!ENTITY manrevision "0.2">
<!ENTITY date "20 June 2004">
<!ENTITY app "Glom">
<!-- Information about the entities
       The legal.xml file contains legal information, there is no need to edit the file. 
       Use the appversion entity to specify the version of the application.
       Use the manrevision entity to specify the revision number of this manual.
       Use the date entity to specify the release date of this manual.
       Use the app entity to specify the name of the application. -->]>
<!-- 
      (Do not remove this comment block.)
  Maintained by the GNOME Documentation Project
  http://developer.gnome.org/projects/gdp
  Template version: 2.0 beta
  Template last modified Apr 11, 2002
-->
<!-- =============Document Header ============================= -->
<article id="index" lang="sv">
<!-- please do not change the id; for translations, change lang to -->
<!-- appropriate code -->
  <articleinfo> 
    <title>Glom User Guide V0.2</title>       
    <subtitle>for Glom v1.6</subtitle>

    <copyright> 
      <year>2004</year> 
      <holder>Murray Cumming</holder> 
    </copyright><copyright><year>2006</year><holder>Daniel Nylander (po@danielnylander.se)</holder></copyright> 
<!-- translators: uncomment this:

  <copyright>
   <year>2002</year>
   <holder>ME-THE-TRANSLATOR (Latin translation)</holder>
  </copyright>

   -->
<!-- An address can be added to the publisher information.  If a role is 
     not specified, the publisher/author is the same for all versions of the 
     document.  -->
    <publisher> 
      <publishername>Gloms utvecklingsteam</publishername> 
    </publisher> 

      <legalnotice id="legalnotice">
         <para>Tillstånd att kopiera, distribuera och/eller modifiera detta dokument ges under villkoren i GNU Free Documentation License (GFDL), version 1.1 eller senare, utgivet av Free Software Foundation utan standardavsnitt och omslagstexter.  En kopia av GFDL finns att hämta på denna <ulink type="help" url="ghelp:fdl">länk</ulink> eller i filen COPYING-DOCS som medföljer denna handbok.</para>
          <para>Denna handbok utgör en av flera GNOME-handböcker som distribueras under villkoren i GFDL.  Om du vill distribuera denna handbok separat från övriga handböcker kan du göra detta genom att lägga till en kopia av licensavtalet i handboken enligt instruktionerna i avsnitt 6 i licensavtalet.</para>
 
         <para>Flera namn på produkter och tjänster är registrerade varumärken. I de fall dessa namn förekommer i GNOME-dokumentation - och medlemmarna i GNOME-dokumentationsprojektet är medvetna om dessa varumärken - är de skrivna med versaler eller med inledande versal.</para>
 
         <para>DOKUMENTET OCH MODIFIERADE VERSIONER AV DOKUMENTET TILLHANDAHÅLLS UNDER VILLKOREN I GNU FREE DOCUMENTATION LICENSE ENDAST UNDER FÖLJANDE FÖRUTSÄTTNINGAR: <orderedlist>
                 <listitem>
                   <para>DOKUMENTET TILLHANDAHÅLLS I "BEFINTLIGT SKICK" UTAN NÅGRA SOM HELST GARANTIER, VARE SIG UTTRYCKLIGA ELLER UNDERFÖRSTÅDDA, INKLUSIVE, MEN INTE BEGRÄNSAT TILL, GARANTIER ATT DOKUMENTET ELLER EN MODIFIERAD VERSION AV DOKUMENTET INTE INNEHÅLLER NÅGRA FELAKTIGHETER, ÄR LÄMPLIGT FÖR ETT VISST ÄNDAMÅL ELLER INTE STRIDER MOT LAG. HELA RISKEN VAD GÄLLER KVALITET, EXAKTHET OCH UTFÖRANDE AV DOKUMENTET OCH MODIFIERADE VERSIONER AV DOKUMENTET LIGGER HELT OCH HÅLLET PÅ ANVÄNDAREN. OM ETT DOKUMENT ELLER EN MODIFIERAD VERSION AV ETT DOKUMENT SKULLE VISA SIG INNEHÅLLA FELAKTIGHETER I NÅGOT HÄNSEENDE ÄR DET DU (INTE DEN URSPRUNGLIGA SKRIBENTEN, FÖRFATTAREN ELLER NÅGON ANNAN MEDARBETARE) SOM FÅR STÅ FÖR ALLA EVENTUELLA KOSTNADER FÖR SERVICE, REPARATIONER ELLER KORRIGERINGAR. DENNA GARANTIFRISKRIVNING UTGÖR EN VÄSENTLIG DEL AV DETTA LICENSAVTAL. DETTA INNEBÄR ATT ALL ANVÄNDNING AV ETT DOKUMENT ELLER EN MODIFIERAD VERSION AV ETT DOKUMENT BEVILJAS ENDAST UNDER DENNA ANSVARSFRISKRIVNING;</para>
                 </listitem>
                 <listitem>
                   <para>UNDER INGA OMSTÄNDIGHETER ELLER INOM RAMEN FÖR NÅGON LAGSTIFTNING, OAVSETT OM DET GÄLLER KRÄNKNING (INKLUSIVE VÅRDSLÖSHET), KONTRAKT ELLER DYLIKT, SKA FÖRFATTAREN, DEN URSPRUNGLIGA SKRIBENTEN ELLER ANNAN MEDARBETARE ELLER ÅTERFÖRSÄLJARE AV DOKUMENTET ELLER AV EN MODIFIERAD VERSION AV DOKUMENTET ELLER NÅGON LEVERANTÖR TILL NÅGON AV NÄMNDA PARTER STÄLLAS ANSVARIG GENTEMOT NÅGON FÖR NÅGRA DIREKTA, INDIREKTA, SÄRSKILDA ELLER OFÖRUTSEDDA SKADOR ELLER FÖLJDSKADOR AV NÅGOT SLAG, INKLUSIVE, MEN INTE BEGRÄNSAT TILL, SKADOR BETRÄFFANDE FÖRLORAD GOODWILL, HINDER I ARBETET, DATORHAVERI ELLER NÅGRA ANDRA TÄNKBARA SKADOR ELLER FÖRLUSTER SOM KAN UPPKOMMA PÅ GRUND AV ELLER RELATERAT TILL ANVÄNDNINGEN AV DOKUMENTET ELLER MODIFIERADE VERSIONER AV DOKUMENTET, ÄVEN OM PART SKA HA BLIVIT INFORMERAD OM MÖJLIGHETEN TILL SÅDANA SKADOR.</para>
                 </listitem>
           </orderedlist></para>
   </legalnotice>
 
   <!-- This file  contains link to license for the documentation (GNU FDL), and 
        other legal stuff such as "NO WARRANTY" statement. Please do not change 
	any of this. -->

    <authorgroup> 
      <author role="maintainer"> 
		<firstname>Murray</firstname> 
		<surname>Cumming</surname> 
		<affiliation> 
	  		<orgname>Gloms utvecklingsteam</orgname> 
	  		<address> <email>murrayc@murrayc.com</email> </address> 
		</affiliation> 
      </author> 
      
<!-- This is appropriate place for other contributors: translators,
     maintainers,  etc. Commented out by default.
     
      <othercredit role="translator">
		<firstname>Latin</firstname> 
		<surname>Translator 1</surname> 
		<affiliation> 
	  		<orgname>Latin Translation Team</orgname> 
	  		<address> <email>translator@gnome.org</email> </address> 
		</affiliation>
		<contrib>Latin translation</contrib>
      </othercredit>
-->
    </authorgroup>


<!-- According to GNU FDL, revision history is mandatory if you are -->
<!-- modifying/reusing someone else's document.  If not, you can omit it. -->
<!-- Remember to remove the &manrevision; entity from the revision entries other
-->
<!-- than the current revision. -->
<!-- The revision numbering system for GNOME manuals is as follows: -->
<!-- * the revision number consists of two components -->
<!-- * the first component of the revision number reflects the release version of the GNOME desktop. -->
<!-- * the second component of the revision number is a decimal unit that is incremented with each revision of the manual. -->
<!-- For example, if the GNOME desktop release is V2.x, the first version of the manual that -->
<!-- is written in that desktop timeframe is V2.0, the second version of the manual is V2.1, etc. -->
<!-- When the desktop release version changes to V3.x, the revision number of the manual changes -->
<!-- to V3.0, and so on. -->  
    <revhistory>
      <revision> 
		  <revnumber>Glom 1.6</revnumber> 
		  <date>20 Juni 2004</date> 
		  <revdescription> 
			 <para role="author">Murray Cumming</para> 
			 <para role="publisher">Murray Cumming</para> 
		  </revdescription> 
		</revision>
    </revhistory> 

    <releaseinfo>This manual describes version 1.6 of Glom
    </releaseinfo> 
    <legalnotice> 
      <title>Återkoppling</title> 
      <para>To report a bug or make a suggestion regarding the Glom or 
	this manual can be submitted to the 
	<ulink url="http://bugzilla.gnome.org" type="http">GNOME Bugzilla
	</ulink>, under the Glom product. Please search bugzilla before
	submitting your bug to ensure that yours hasn't already been reported.
      </para>
<!-- Translators may also add here feedback address for translations -->
    </legalnotice> 

    <abstract role="description">
      <para>Användarhandbok för Glom.</para>
    </abstract>
  </articleinfo> 

  <indexterm zone="index"> 
    <primary>MY-GNOME-APP</primary> 
  </indexterm> 
  <indexterm zone="index"> 
    <primary>mygnomeapp</primary> 
  </indexterm>

<!-- ============= Document Body ============================= -->
<!-- ============= Introduction ============================== -->
<!-- Use the Introduction section to give a brief overview of what
     the application is and what it does. -->
  <sect1 id="mrp-introduction"> 
    <title>Introduktion</title> 
    <para>Glom låter dig designa och använda databassystem.</para>
    <!-- TODO: Take text from the website. -->
  </sect1>

<!-- =========== Getting Started ============================== -->
<!-- Use the Getting Started section to describe the steps required
     to start the application and to describe the user interface components
     of the application. If there is other information that it is important
     for readers to know before they start using the application, you should
     also include this information here. 
     If the information about how to get started is very short, you can 
     include it in the Introduction and omit this section. -->

  <sect1 id="glom-getting-started"> 
    <title>Komma igång</title> 

    <sect2 id="glom-start">
    <title>Starta Glom</title>
    <para>Du kan starta <application>Glom</application> på följande sätt:</para> 
    <variablelist>
    	<varlistentry>
    		<term><guimenu>Applications</guimenu> menu</term>
    		<listitem>
    		<para>Choose 
    		<menuchoice>
    		<guisubmenu>Office</guisubmenu>
    		<guimenuitem>Glom</guimenuitem>
    		</menuchoice>. </para>
    		</listitem>
    	</varlistentry>
    </variablelist>
    </sect2>

    <sect2 id="glom-when-start">
    <title>When You Start Glom</title>
    <para>When you start <application>Glom</application>, the following window is 
	displayed.</para>

    <!-- ==== Figure ==== -->
      <figure id="newproject"> 
	<title>Glom Start Up Window</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/start.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Shows Glom main window.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
      </figure>
    <!-- ==== End of Figure ==== -->
  </sect2>
  </sect1>
<!-- ================ Usage ================================ -->
<!-- Use this section to describe how to use the application to perform the tasks for 
  which the application is designed. -->


    <sect1 id="glom-operator-usage">
    <title>Using Glom as an Operator</title>
    <para>To open an existing Glom document, either open that document from the File Manager, or choose Glom from the Applications menu, and then choose the document when asked. Glom will ask you for a user name and password to access the database. Your administrator will provide your user name and password.</para>

    <para>When you open an existing document, Glom will be in <literal>Operator</literal> <literal>user level</literal>. This user level allows you to find and edit records, but does not allow you to change the fundamental structure of the database.</para>

    <sect2 id="navigation">
    <title>Navigering</title>
    <para>Each database has several tables. To look at a different table, choose <literal>Tables</literal> from the <literal>Navigate</literal> menu. Then double-click on the table, or select it and click the <literal>Open</literal> button.</para>

    <figure id="operator-navigation-tables"> 
	<title>Navigating to a Table</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_tables.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Navigating to a Table.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
     </figure>

    </sect2>

    <sect2 id="viewing-and-entering-data">
    <title>Viewing and Entering Data</title>
    <para>When in <literal>Data Mode</literal>, you can view or enter information in either the <literal>List</literal> or <literal>Details</literal> view.</para>

      <sect3 id="the-list-view">
      <title>The List View</title>
      <para>The List view shows many records at once and usually shows only the most important fields.</para>
      <para>When you enter data into a field it will be saved into the database immediately after you finish editing the field. If it is a date or time field then the data format will be checked for you.</para> 
      <para>To create a new record just click the <literal>New</literal> button, or start typing into a field in the last empty row. A new record row will be created with blank fields for you to fill in.</para>

      <figure id="operator-data-list"> 
	<title>The List View</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_data_list.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>The List View.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
      </figure>

      <para>To sort the records just click on a column header. For instance, you could might click on a date column to list invoices in order of their date, and click again to list them in reverse order.</para>
      </sect3>

      <sect3 id="the-details-view">
      <title>The Details View</title>
      <para>The details view shows only one record and usually shows all the fields arranged suitably.</para>
      <para>When you enter data into a field it will be saved into the database immediately after you finish editing the field. If it is a date or time field then the data format will be checked for you.</para>
      <para>To create a new record just click the <literal>New</literal> button. A new record will be created with blank fields for you to fill in.</para>

  <figure id="operator-data-details"> 
	<title>The Details View</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_data_details.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>The Details View.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
      </figure>

      </sect3>

    </sect2>

    <sect2 id="finding-data">
    <title>Finding Data</title>
    <para>Choose <literal>Find Mode</literal> from the Mode menu. The fields in the List and Details views will now be empty, and a Find button will appear at the bottom of the window.</para>
    <para>Enter information, or part of the information, into a field to find records with that information in that field. For instance, enter Jim into a name field to find records with "Jim" or "Jimmy" in the name.</para> 
    <para>When you press the <literal>Find</literal> button, Glom will search for records and then display them. If only one record is found then it will show you that record in the Details view. If several records are found then it will show you those records in the List view.</para>
    <!-- TODO: screenshot -->
    </sect2>

    <sect2 id="glom-operator-printing-reports">
    <title>Printing Reports</title>
    <para>If your database developer has defined some reports for a table then you will seem them listed in the <literal>Reports</literal> menu. Just choose the report from the menu to create the report. If you have previously performed a search then the report will contain only the currently-found data. Otherwise it will contain all data in the current report. Remember that each table has its own reports so you may need to switch to the relevant table to use a particular report.</para>

     <figure id="operator-report-result"> 
	<title>A report</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_report_result.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>A report.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
      </figure>

    </sect2>


    </sect1>

    <sect1 id="glom-developer-usage">
    <title>Using Glom as a Developer</title>
    <para>When you create a new document, Glom will be in the <literal>Developer</literal> <literal>user level</literal>. You can also change to the Developer user level after opening an existing document, with the <literal>User Level</literal> menu. Glom will only allow this if the administrator has allowed it.</para>

    <sect2 id="adding-tables">
    <title>Adding Tables</title>
    <para>You can see the list of existing tables by choosing <literal>Tables</literal> from the <literal>Navigate</literal> 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 <literal>Add</literal> button and enter the name for the new table. Glom will suggest a human-readable title for this table. <literal>Operators</literal> will see this title instead of the actual table name. You can also mark a tables as <literal>hidden</literal> 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.</para>
    <!-- TODO: screenshot -->
    <para>You can also specify one table as the <literal>default table</literal>. This table will be shown whenever an operator opens an existing document, without asking him to select a table from the list.</para>
    <para>You can also use this window to rename an existing table.</para>
    <para>Click the <literal>Open</literal> button to look at the selected table.</para>
    </sect2>

    <sect2 id="editing-fields">
    <title>Editing Fields</title>
    <para>Choose <literal>Fields</literal> from the <literal>Developer</literal> 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.</para>
    <para>Click the <literal>Add</literal> 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. <literal>Operators</literal> will see this title instead of the actual field name.</para> 
    <para>To specify more field details, select the field and click the <literal>Details</literal> button.</para>

    <figure id="developer-editing-fields"> 
	<title>Editing Fields</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_fields.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Editing the table's fields.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
     </figure>


    <sect3 id="primary-keys">
    <title>Primära nycklar</title>
    <para>Each table must have one, and only one, <literal>Primary Key</literal>. 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 <link linkend="sec-developer-relationships">Creating Relationships</link> section to see how you can relate tables together.</para>
    </sect3> 

    <sect3 id="field-types">
    <title>Fälttyper</title>
    <para>Glom offers a few simple field types:
    <orderedlist>
<listitem><simpara>Number</simpara></listitem>
<listitem><simpara>Text</simpara></listitem>
<listitem><simpara>Datum</simpara></listitem>
<listitem><simpara>Tid</simpara></listitem>
<listitem><simpara>Boolean - either true or false</simpara></listitem>
<listitem><simpara>Bild</simpara></listitem>
</orderedlist>
    </para>
    </sect3>
  
    <sect3 id="calculated-fields">
    <title>Calculated Fields</title>
    <para>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.</para>
    <para>You can also use calculations to specify a default value for fields, by selecting the <literal>Default Value</literal> tab in the <literal>Field Details</literal> window, clicking on the <literal>Calculate Value</literal> check box, and then entering a Python calculation. You can test this calculation in the <literal>Edit</literal> window.</para>  
    </sect3>

    </sect2>

    <sect2 id="arranging-layouts">
    <title>Arranging Layouts</title>
    <para>Each table has <literal>List</literal> and <literal>Details</literal> views, and by default these show all fields in the table, in order of creation. You can edit the layout by choosing <literal>Layout</literal> from the <literal>Developer</literal> menu.</para>

    <sect3 id="arranging-the-list-view">
    <title>Arranging the List View</title>
    <para>For the <literal>List</literal> view, you can specify the sequence of field columns, and whether some fields are hidden.</para>

    <figure id="developer-layout-list"> 
	<title>Editing the List Layout</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_layout_list.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Editing the list layout.</phrase> 
	    </textobject>
	  </mediaobject> 
	</screenshot> 
     </figure>
    </sect3>

    <sect3 id="arranging-the-details-view">
    <title>Arranging the Details View</title>
    <para>For the <literal>Details</literal> 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.</para>

    <figure id="developer-layout-details"> 
	<title>Editing the details Layout</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_layout_details.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Editing the Details Layout.</phrase> 
	    </textobject>
	  </mediaobject> 
	</screenshot> 
     </figure>
    </sect3>

    </sect2>

    <sect2 id="sec-developer-relationships">
    <title>Creating Relationships</title>
    <para>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.</para>
    <para>To create relationships, choose <literal>Relationships</literal> from the <literal>Developer</literal> menu. This will show the list of existing relationships. Click the <literal>Add</literal> 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.</para>
    <!-- TODO: screenshot -->
   <para>You can use the relationship in the following places.

<orderedlist>
<listitem><simpara>To show a related field on the List or Details view.</simpara></listitem>
<listitem><simpara>To show a list of related records on the Details view.</simpara></listitem>
<listitem><simpara>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.</simpara></listitem>
<listitem><simpara>To calculate a field value.</simpara></listitem>
</orderedlist>
   </para>
   </sect2> 

   <sect2 id="users-administration">
   <title>Users Administration</title>
   <para>To define the <literal>Operators</literal> who can use your database, and to specify what access they have to the various tables, choose <literal>Users</literal> from the <literal>Developer</literal> menu.</para>
    <!-- TODO: screenshot -->
   </sect2>

   <sect2 id="translations">
   <title>Translations</title>
   <para>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.</para>
   <para>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 <literal>Translations</literal> from the <literal>Developer</literal> 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.</para>

   <!-- TODO: Update this screenshot -->
   <figure id="developer-translations"> 
	<title>Translations</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_translations.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Translations.</phrase> 
	    </textobject>
	  </mediaobject> 
	</screenshot> 
     </figure>

    <para>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 <literal>Export</literal> 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 <literal>Import</literal> button.</para>  

   </sect2>

   <sect2 id="defining-reports">
   <title>Defining Reports</title>

   <sect3 id="adding-or-editing-reports">
   <title>Adding or Editing Reports</title>

   <para>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 <literal>Reports</literal> menu.</para>
   <para>To define a report, or to change the definition of an existing report, choose <literal>Reports</literal> from the <literal>Developer</literal> menu.</para>
   <figure id="developer-editing-reports"> 
	<title>Creating or Editing Reports</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_reports.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Creating or editing reports.</phrase> 
	    </textobject>
	  </mediaobject> 
	</screenshot> 
     </figure>

    <para>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.</para>

    </sect3>

    <sect3 id="editing-a-report">
    <title>Editing a Report</title>

    <para>A Glom report has three areas:
    <orderedlist>
      <listitem><simpara>The Header, which appears at the start of the report</simpara></listitem>
      <listitem><simpara>The Main area, in which the records and summary lines are shown, with the actual data from the database.</simpara></listitem>
      <listitem><simpara>The Footer, which appears at the end of the report.</simpara></listitem>
    </orderedlist>
    </para>

    <para>Inside an area, such as the Main part, you may add report <literal>Parts</literal>, 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 <literal>Available Parts</literal> list and then clicking the <literal>Add</literal> button. The part will then be added to the <literal>Parts</literal> list, in the selected area.</para>
    <para>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 <literal>Parts</literal> list and click the <literal>Edit</literal> button. You may also specify field formatting by clicking the <literal>Formatting</literal> button, just as you would when defining a details or list layout.</para>

    <figure id="developer-editing-reports-details"> 
	<title>Editing a Report</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_reports_details.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Editing a report.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
     </figure>

    <para>Some parts may contain other parts and have extra properties to control how they present their child parts. For instance, the <literal>Group By</literal> 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 <literal>Group By</literal> part, by selecting your top-level <literal>Group By</literal> part in the <literal>Parts</literal> list while adding a new <literal>Group By</literal> part from the <literal>Available Parts</literal> list. For instance, you might group your products by manufacturer, inside each product type group.</para>
    <para>To specify the field by which the records should be grouped, select your <literal>Group By</literal> part in the <literal>Parts</literal> list and click the <literal>Edit</literal> 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.</para>

    <figure id="developer-editing-reports-group_by"> 
	<title>Editing a Group By Part</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_reports_group_by.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Editing a report.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
     </figure>

   <para>The <literal>Vertical Group</literal> 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.</para>
   
   <figure id="developer-editing-reports-vertical_group"> 
	<title>A Report with Vertical Groups</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_reports_vertical_group.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>A Report with Vertical Groups.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
     </figure> 

   <para>When you have finished, click the <literal>Close</literal> button to save the report's definition. Your report can then be chosen from the <literal>Reports</literal> menu. See the <link linkend="glom-operator-printing-reports">Printing Reports</link> section for more details.</para>



   </sect3>

   </sect2>
  
  </sect1>

<!-- =============Dialogs ================================= -->
<!-- This section contains the help to all dialogs that contain help button -->

<sect1 id="dialogs">
<title>Dialogs</title>

<sect2 id="dialog_existing_or_new">
<title>Dialog: Initial dialog</title>
<para>This dialog allows the user to choose an existing document or create a new document. Existing documents may be selecting from the list of recently opened documents or by select a file with the file chooser dialog. Documents can also be opened via the network if other users are running Glom on the local network. Finally, a new document can be created either by opening a template file which already contains some initial tables and records, or by creating an empty document.</para>
</sect2>

<sect2 id="dialog_new_database">
<title>Dialog: New database</title>
<para/>
</sect2>

<sect2 id="dialog_error_create_database">
<title>Dialog: Create database</title>
<para/>
</sect2>

<sect2 id="dialog_connection">
<title>Dialog: Connection</title>
<para>This dialog requests a user name and password for connection to a database server. This is usually not the same username and password combination with which you log in to your system. All Glom systems require a database server on which the actual data will be stored. If the database server is not running on your local computer ("localhost"), then you must also provide its network hostname, such as "glomserver.openismus.com", though your hostname will be different.</para>
<para>Your system administrator can provide these database login details.</para>
<para>If you are the system administrator, see Glom's <ulink url="http://www.glom.org/wiki/index.php?title=Initial_Postgres_Configuration" type="http">Postgres Configuration</ulink> web page for help with installing and configuring a database server.</para>
</sect2>

<sect2 id="dialog_error_connection">
<title>Dialog: Connection Error</title>
<para>This dialog is shown when Glom could not connect to the specified database server. Either the database server is not running at the specified hostname, or the user name and password were not accepted by the database server. See the <link linkend="dialog_connection">Connection Dialog</link> section for more details.</para>

<para/>
</sect2>

<sect2 id="dialog_database_preferences">
<title>Dialog: Database preferences</title>
<para/>
</sect2>

<sect2 id="dialog_change_language">
<title>Dialog: Change language</title>
<para/>
</sect2>

<sect2 id="window_textobject">
<title>Window: Textobject</title>
<para/>
</sect2>

<sect2 id="window_imageobject">
<title>Window: Imageobject</title>
<para/>
</sect2>

<sect2 id="dialog_notebook">
<title>Dialog: Notebook</title>
<para/>
</sect2>

<sect2 id="dialog_data_invalid_format">
<title>Dialog: Data invalid format</title>
<para/>
</sect2>

<sect2 id="dialog_relationship_overview">
<title>Dialog: Relationship overview</title>
<para/>
</sect2>

<sect2 id="window_groups">
<title>Window: Groups</title>
<para/>
</sect2>

<sect2 id="dialog_groupby_sort_fields">
<title>Dialog: Group by sort fields</title>
<para/>
</sect2>

<sect2 id="dialog_groupby_secondary_fields">
<title>Dialog: Group by secondary fields</title>
<para/>
</sect2>

<sect2 id="window_button_script">
<title>Window: Button script</title>
<para/>
</sect2>

<sect2 id="window_field_calculation">
<title>Window: Field calculation</title>
<para/>
</sect2>

<sect2 id="dialog_new_group">
<title>Dialog: New group</title>
<para/>
</sect2>

<sect2 id="dialog_choose_user">
<title>Dialog: Choose user</title>
<para/>
</sect2>

<sect2 id="dialog_user">
<title>Dialog: User</title>
<para/>
</sect2>

<sect2 id="dialog_translation_identify_original">
<title>Dialog: Translation identify original</title>
<para/>
</sect2>

<sect2 id="dialog_translation_copy">
<title>Dialog: Translation copy</title>
<para/>
</sect2>

<sect2 id="dialog_choose_date">
<title>Dialog: Choose Date</title>
<para/>
</sect2>

<sect2 id="dialog_import_csv">
<title>Dialog: Import Into Table</title>
<para>This dialog allows the user to import a CSV (comma separated value) file into the current database table. It shows the first few rows of the file to import and allows the user to select the target field in the database for each column in the CSV file. For auto-incremented primary keys, the primary key field cannot be used as a target field, but otherwise one column must be imported into the primary key field.</para>
</sect2>

</sect1>

<!-- ============= Bugs ================================== -->
<!-- This section is optional and is commented out by default. 
     You can use it to describe known bugs and limitations of the 
	  program if there are any - please be frank and list all
     problems you know of. 
  
  <sect1 id="mayapp-bugs">
  <title>Known Bugs and Limitations</title>
  <para> </para>
 </sect1>
-->
<!-- ============= About ================================== -->
<!-- This section contains info about the program (not docs), such as
      author's name(s), web page, license, feedback address. This
      section is optional: primary place for this info is "About.." box of
      the program. However, if you do wish to include this info in the
      manual, this is the place to put it. Alternatively, you can put this information in the title page.-->
 <sect1 id="Glom-about"> 
    <title>About Glom</title> 
    <para> Glom is maintained by Glom and GNOME community volunteers.
      To find more information about
      Glom, please visit the 
      <ulink url="http://www.glom.org/" type="http">Glom Web
      site</ulink>. </para>
    <para>
      To report a bug or make a suggestion regarding this application or
      this manual, you can submit them using 
      <ulink url="http://bugzilla.gnome.org" type="help">bugzilla</ulink>.
    </para>

    <para>
      Another excellent source of information are the Glom 
      <ulink url="http://www.glom.org" type="http">mailing lists</ulink>.
    </para>

    <para> This program is distributed under the terms of the GNU
      General Public license as published by the Free Software
      Foundation; either version 2 of the License, or (at your option)
      any later version. A copy of this license can be found at this
      <ulink url="ghelp:gpl" type="help">link</ulink>, or in the file
      COPYING included with the source code of this program. </para>
  </sect1>

  <appendix id="sec-concepts">
  <title>Concepts</title>
  <para>Glom is easy to use, but you must understand the following basic concepts.
<orderedlist>
<listitem><simpara><literal>Database</literal>: Each Glom document allows access to one database.</simpara></listitem>
<listitem><simpara><literal>Table</literal>: Each database contains several tables, such as "Customers" and "Invoices" tables.</simpara></listitem>
<listitem><simpara><literal>Field</literal>: Each table has several fields, such as "Customer ID", "First Name", and "Date of Birth" fields. In other documents and applications, fields are sometimes called "Columns"</simpara></listitem>
<listitem><simpara><literal>Records</literal>: Each table contains several records, each of which has values for each of the fields. For instance, the "Customers" table will have a record for each customer. In other documents and applications, records are sometimes called <literal>Rows</literal>.</simpara></listitem>
<listitem><simpara><literal>Relationships</literal>: Each table might be related to other tables, via fields in both tables. For instance, a "Customers" table could have a relationship to the "Invoices" table, so that people could see all the invoices for that customer. Only developers need to understand this concept. In other documents and applications, relationships are sometimes called "Joins".</simpara></listitem> 
</orderedlist>
  </para>
  </appendix>

  <appendix id="sec-calculated-fields">
  <title>Calculated fields and button scripts</title>
  <para>Calculated fields and button scripts use the Python programming language. The calculation or script is the implementation of a function whose signature is provided for you.</para>

     <figure id="developer-editing-fields-calculated"> 
	<title>Editing the definition of a calculated field</title> 
	<screenshot> 
	  <mediaobject> 
	    <imageobject><imagedata fileref="figures/glom_design_fields_dialog_calculated.png" format="PNG"/> 
	    </imageobject>
	    <textobject> 
	      <phrase>Editing the definition of a calculated field.</phrase> 
	    </textobject> 
	  </mediaobject> 
	</screenshot> 
     </figure>

  <sect1 id="field-values">
  <title>Field values</title>
  <para>For instance, <programlisting>record["name_first"]</programlisting> is the value of the name_first field in the current record.</para>
  </sect1>

  <sect1 id="related-records">
  <title>Related Records</title>
  <para>For instance, <programlisting>record.related["location"]</programlisting> provides the related records for the current record.</para>

  <sect2 id="single-related-records">
  <title>Single related records</title>
  <para>For relationships that specify a single record, you can get the value of a field in that record. For instance, <programlisting>record.related["location"]["name"]</programlisting> is the value of the name field in the table indicated by the location relationship (often called location::name).</para>
  </sect2>

  <sect2 id="multiple-related-records">
  <title>Multiple related records</title>
  <para>For relationships that specify multiple records, you can use the aggregate functions (sum, count, average) to get overall values. For instance, <programlisting>record.related["invoice_lines"].sum("total_price")</programlisting>.</para>
  </sect2>

  </sect1>

  <sect1 id="testing-for-empty-values">
  <title>Testing for empty values</title>
  <para>
  How you test for empty values depends on the type of field:
  </para>

  <sect2 id="non-text-fields">
  <title>Non-text fields</title>
  <para>Non-text fields may be empty, indicating that the user has not entered any value in the field. For instance, Glom does not assume that an empty value in a numeric field should mean 0.</para>
  <para>You can test whether a field is empty by using Python's None. For instance:</para>
  <para>
  <programlisting>
  if(record["contact_id"] == None):
    return "No Contact"
  else:
    return record.related["contacts"]["name_full"]
  </programlisting>
  </para>
  <para>You might also test whether there are any related records. For instance:</para>
  <para>
  <programlisting>
  if(record.related["contacts"] == None):
    return "No Contact"
  else:
    return record.related["contacts"]["name_full"]
  </programlisting>
  </para>
  </sect2>

  <sect2 id="text-fields">
  <title>Text fields</title>
  <para>For text fields, you should check for zero-length strings. It is not possible in Glom to distinguish between zero-length strings and the absence of any string, because there is no advantage to doing so. For instance:</para>
  <para>
  <programlisting>
  if(record["name_full"] == ""):
    return "No Name"
  else:
    return record["name_full"]
  </programlisting>
  </para>
  </sect2>
</sect1>


<sect1 id="using-the-full-pygda-api">
  <title>Using the full pygda API</title>
  <para>pygda is a python API for the libgda API. The record's <literal>connection</literal> attribute provides a gda.connection that can be used to access the current database directly. This allows you to run any SQL query, for instance to read data from the database with a SELECT, or to change values in the database with an UPDATE. Note that the connection is already open so you can avoid the difficult work of specifying the connection details.</para>
  <para>The record's <literal>table_name</literal> attribute also provides the name of the current table.</para>
  <para>This example reads all data from the current table and prints the values to the terminal: </para>
  <para>
  <programlisting>
# Use the current database's connection 
# to get all the data for the current table.
#
# record.connection is an already-open gda.connection object,
# saving us the bother of opening the connection,
# or even knowing the name of the database.

query = "SELECT * FROM %s" % record.table_name
data_model = gda.gda_execute_select_command(record.connection, query)

rows = data_model.get_n_rows()
columns = data_model.get_n_columns()
print "    Number of columns: ", columns

for i in range(columns):
    print "      column ", i;
    print "        name=", data_model.get_column_title(i)

    # Find out whether it's the primary key:
    field = data_model.describe_column(i)
    if field.get_primary_key():
        print "        (primary key)"

    print "\n";
     
print "    Number of rows: ", rows

for row_index in range(rows):
    print "      row ", row_index;

    for col_index in range(columns):
        print "        value=", data_model.get_value_at(col_index, row_index).get()

    print "\n";
  </programlisting>
  </para>
  </sect1>

  </appendix>

 
</article>
