next up previous contents index
Next: 2.3 Adding some final Up: 2 Developing an nxqddb Previous: 2.1 Creating a simple

2.2 Improving the simple addressbook

  Let's improve our addressbook that we built in the previous section. In particular, let's provide the capability to have multiple addresses and phone numbers. And just for fun, let's add some new fields. We'll add a sex field to show how to dynamically change text entries to radiobuttons and a birthdate field to illustrate some of nxqddb's date functionality. Also, we want to group like fields together. To accomplish these tasks, we modify our Schema file just a little bit. Let's call this version AddressBook2. To create AddressBook2, follow these steps:



    1) $ cd ~/Databases
    2) $ qnewdb AddressBook2
    3) $ vi AddressBook2/Schema

  
Figure 2.4: Creating AddressBook2 database






Note, you should already have the Databases directory setup from the previous section. Also, you should already have the environment variable, QDDBDIRS pointing to your ~/Databases directory.

In your editing session of AddressBook2/Schema create the schema shown in figure 2.5:



Name ( First Middle Last )
Address ( Street City State Zip Email HomePage ) *
Phone ( Description AreaCode Number ) *
Sex
Relation
Birthday type date
Comments *

  
Figure 2.5: AddressBook2 Schema containing Structured Expandable Attributes





There are several things to note about the syntax of the schema shown in figure 2.5:

You can type your schemas free-form. Note in figure 2.5 how we have included more than one field on the same line. For example, First Middle Last are on the same line. You could just have easily created the schema to look like the schema shown in figure 2.6.



Name (
    First
    Middle
    Last
)
Address (
    Street
    City
    State
    Zip
    Email
    HomePage
) *
Phone (
    Description
    AreaCode
    Number
) *
Sex
Relation
Birthday type date
Comments *

  
Figure 2.6: Another syntax that gives the same results





After entering this new schema for AddressBook2, we display the nxqddb window shown in figure 2.7 by typing ``nxqddb AddressBook2''

  figure188
Figure 2.7: An improved Addressbook


next up previous contents index
Next: 2.3 Adding some final Up: 2 Developing an nxqddb Previous: 2.1 Creating a simple

Herrin Software Development, Inc.