Intro to the Data Source View

From NeoWiki

Revision as of 18:47, 4 November 2007 by Lorinda (Talk | contribs)
Jump to: navigation, search
This article is part of the To Base and Back Again tutorial series.

Reports and Forms are actually Writer documents stored within the odb file of your database. But you can also access the data in registered databases from Writer documents that are not stored within the odb file. This tutorial discusses some of the ways to access and use this data.

Contents

Registering The Database

In order to access data in from Writer, the database must be registered. When you create a new database, the Database Wizard asks if you want to register the new database. Under normal conditions, you want to check Yes. If you accidently checked No, or if you have received an odb file from someone else, here's how to register the database:

  1. In the NeoOffice menu, choose Preferences
  2. Double-click on NeoOffice Base to disclose the sub-categories
  3. Click on Databases. You will see a list of registered databases.
  4. Click the New... button. The Create Database Link window appears
  5. Click the Browse... button and navigate to the database file you want to register.
  6. If desired, you may give it a Registered name different than the file path.
  7. Click OK in the Create Database Link window.
  8. Click OK in the Options-NeoOffice Base-Databases window.


Accessing the Datasource

  1. In an open Writer, document, click on the Data Sources button on the Standard Toolbar, or go to the View menu and select DataSources. The Data Source View opens just below the toolbars, above your document.
  2. In the Data Explorer (the left column with a list of data sources), click on the disclosure triangle next to the name of the database file you want to work with.
  3. Now click on the disclosure triangle next to Queries or Tables under the seleted database name.
  4. Select the specific Query or Table you want to work with for this document. (e.g. the All Sightings query). wait while the data loads. Note that the more complex the query, the longer you will need to wait. (The wait time may also be affected by available memory, CPU load, and processor speed).
  5. Make sure that the Table Data Toolbar is visible at the top of the Data Source View. See #Anatomy of the Data Source View.
    • If this toolbar does not, appear, you will need to move or rename your preferences folder, as there does not seem to be any other way to turn it on from within the program. See the articles on corrupted preferences and Salvaging Settings from Preferences for directions. When I encountered this problem, I narrowed the troublesome spot down to the registry folder. Instead of moving the entire preferences folder, you might try moving/renaming just the registry folder. Note that you will lose data source registrations if you need to do this. See Registering the Data Source.
      Due to the fact that this toolbar cannot be turned back on without moving preferences, DO NOT close the Table Data toolbar.


Anatomy of the Data Source View


Image:DataSources.png

Adjusting the Appearance of the Data

With the Data Source View open, there are several things you can do to change the appearance of the data.

  • To change the formatting data in a particular column (e.g. the Date column in the Field Trips table), right-click or control-click on the column heading (e.g. Date) and select Column Format... from the contextual menu. A Field Format window will open where you can adjust the formatting.
  • To change the font and font formatting used in the table data, right-click or control click on any of the grey "cells" to the left of a record and choose Table Format... from the contextual Menu.
  • To change the width of the column, there are two options:
    Place your cursor on the border between the two columns. The cursor icon will change to a line with arrows pointing left and right. Hold down the mouse button and drag the border to the desired location
    Control-click or right-click on the column heading and choose Column Width... from the contexual menu. In the window that appears, alter the column width as desired.
  • To hide a column (i.e. if you don't need to see/work with that data) control-click or right-click on the column heading and choose Hide Columns from the contextual menu.
    • To show a previously hidden column, control-click or right-click on any column heading and choose Show Columns and then the column you want to show. (Note that Show Columns only appears is one or more columns are actually hidden).
  • To Hide the Explorer (the colum to the left showing you a list of Data sources with their queries and tables), click on the Explorer On/Off button on the Table Data Toolbar. (It looks like a folder with a magnifying glass).


Editing Data in Data Source View

In some cases, you can actually edit your data in the Data Source View in Writer.

You can edit data in:
  • Tables that are part of an embedded database (using the HSQLDB engine, as we have done in this tutorial)
You cannot edit data in:
The ability to edit tables in Base files which connect to other database engines will vary. Users who connect to other database engines are encouraged to add details to this section. Make sure to specify connection type. If you don't have a wiki editing account, you may send a private message Lorinda at trinity with the information. (Note that you need to be a registered user at trinity to use its private message function.)
Note: The Edit Data button on the Table Data toolbar must be highlighted to edit data. (It looks like a sheet of paper with a pencil over it). If you don't want to accidentally edit data while working with a data source, click this button to un-highlight it, and you will be unable to edit data. This same button will be dimmed if the current data source type does not permit editing.
  • To edit an existing record in Data Source View, click in the cell containing the data you want to edit. A blinking cursor will appear in the cell and you can edit the contents.
  • To add a record, scroll down to the bottom of the visible data. (Or click on the sunburst icon on the navigation bar at the bottom of the Data Source View). You will see a blank record with a sunburst icon in the far left grey square. Click anywhere in this record, and begin typing to add the new record. (Note that the starburst icon in the far left square moves down one more record as soon as you start typing.)
  • To delete an existing record, control-click or right-click in the small unlabled "cell" on the far left of the data table. Select Delete rows from the contextual menu.

If you are unable to edit your data in the Data Source View, or if you prefer to enter/edit data in the database file itself (for example, field trip and sightings data is best entered in the Field Trips Data Entry form), you can control-click or right click on the data base icon next to the name of the data source in the Explorer and select Edit Database from the contextual menu.

Filtering Data in Data Source View


Once you have selected the query or table you want to work with, you can filter the data using either the Auto Filter button or the Standard Filter button.

Using Auto Filter

Using the Standard Filter

Sorting Data in Data Source View


Inserting Fields from the Data Source


Adding Fields in the flow of your document


Quickly Creating a Writer Table


Using the Next Record Field


Issues with Image Fields

Creating Forms in Writer Documents

Forms are not limited to those stored within an odb file. You can also create a form in an "independent" or "external" Writer document. When working with forms, you do not use the Data Source View.

  1. Make Sure that the Form Controls and Form Design toolbars are visible. If they are not, go to the View menu, choose Toolbars and select the needed toolbars.
  2. Click on the Form button. The Form Properties window should appear.
    You can also reach the Form Properties window by clicking on the Form Navigator button, control-clicking on the name of the form (most likely Standard), and choosiing Properties.
  3. Click on the Data tab.
  4. Click on the ... next to Data Sources and browse to locate the desired data source
  5. Set the Content type for Table or Query, depending on your source. Those familiar with SQL can also choose SQL Command
  6. Select the desired Query or Table from the Content drop-down
  7. Adjust other settings as desired, and close the Form Properties window.

From this point on, editing forms in an independent Writer document should work the same way editing forms stored in he odb file do.

Related Wiki Links

Using the Mail Merge Wizard
Various Form Tutorials in the To Base and Back Again series.

External Links

Personal tools