dbTalk Databases Forums  

Openoffice Base: Right way for a relation

comp.databases comp.databases


Discuss Openoffice Base: Right way for a relation in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Berti Ferranti
 
Posts: n/a

Default Openoffice Base: Right way for a relation - 08-06-2006 , 10:17 AM






Hi folks,

I've had to recently do my entire database over again because I majorly
fudged up on a relation, rendering the db entirely useless. So, in order
to avoid something like this happening again, I wanted to run this by
you lads, maybe you have an idea how to get this working:

Table #1: People

Contains people's names, addresses and the like.

Table #2: Boxes:

Contains box numbers, these need to be entered without assigning them at
the same time.

Form #1 (operating on table #1): Appointments:

Allows users to enter appointments for the people.
Here, users should also be able to assign boxes to people (1:1).

How should the form and the relationship be set up? Setting the
relationship 1:1 (using people-ID as primary key in both tables) caused
the initial crash, possibly because of a setting that was wrong somehow
- other tries have yielded complaints about integrity.

Ideally, the end result would be a report containing name, address and
apppointment from table #1 and the assigned box number, all entered
through form #1.

An added bonus would be if the form would also be able to pick entries
from table #2 through a query. If a certain identifier in table #1 is
set A , a combobox would contain one query A, if set to B, query B.

Any help would be much appreciated!

Berti

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default Re: Openoffice Base: Right way for a relation - 08-07-2006 , 06:50 AM







Berti Ferranti wrote:
Quote:
Hi folks,

I've had to recently do my entire database over again because I majorly
fudged up on a relation, rendering the db entirely useless. So, in order
to avoid something like this happening again, I wanted to run this by
you lads, maybe you have an idea how to get this working:

Table #1: People

Contains people's names, addresses and the like.

Table #2: Boxes:

Contains box numbers, these need to be entered without assigning them at
the same time.

Form #1 (operating on table #1): Appointments:

Allows users to enter appointments for the people.
Here, users should also be able to assign boxes to people (1:1).

How should the form and the relationship be set up? Setting the
relationship 1:1 (using people-ID as primary key in both tables) caused
the initial crash, possibly because of a setting that was wrong somehow
- other tries have yielded complaints about integrity.

Ideally, the end result would be a report containing name, address and
apppointment from table #1 and the assigned box number, all entered
through form #1.

An added bonus would be if the form would also be able to pick entries
from table #2 through a query. If a certain identifier in table #1 is
set A , a combobox would contain one query A, if set to B, query B.

Any help would be much appreciated!

Berti
OK, I don't know much about OpenOffice or 'boxes' so I'm not quite sure
if I even understand the question. Anyway, my answer is not very
sophisticated:

The tables could look like this:

contacts(contact_id*,contact_name,contact_address)

boxes(box_id*,box_no)

appointments(contact_id*,box_id*,datetime*)

* = Primary Key. Note that the Primary Key on the appointments table is
comprised of all three pieces of information - on the assumption that
nobody can be in the SAME place at the SAME time TWICE! This does not
however preclude the box being, as it were, 'double-booked'. To do
that, the PRIMARY KEY would be comprised solely of the box_id and the
datetime. However, that still wouldn't prevent a contact being
'double-booked' - but I'm going to suggest that that's beyond the scope
of this answer!

I don't know how queries are constructed but let's just assume they're
a bit like MySQL:

SELECT a.datetime,b.box_no,c.contact_name,c.contact_addre ss
FROM appointments a
LEFT JOIN boxes b ON a.box_id = b.box_id
LEFT JOIN contacts c ON a.contact_id = c.contact_id;

Your form simply populates the appointments table from information
supplied by the other two tables.

HIH



Reply With Quote
  #3  
Old   
Berti Ferranti
 
Posts: n/a

Default Re: Openoffice Base: Right way for a relation - 08-07-2006 , 02:13 PM



zac.carey (AT) gmail (DOT) com schrieb:

Hi Zac!

Quote:
OK, I don't know much about OpenOffice or 'boxes' so I'm not quite sure
if I even understand the question. Anyway, my answer is not very
sophisticated:
'Boxes' are just plain boxes that need to be put into somebody's house.
I basically need a way to be able to plan putting said boxes into
people's houses at a certain point in time. The main question is: how do
I enter the relations between people, boxes and appointments once to
have them show in a combined query.


Quote:
The tables could look like this:

contacts(contact_id*,contact_name,contact_address)

boxes(box_id*,box_no)

appointments(contact_id*,box_id*,datetime*)
Actually, appointments was supposed to be a form, with the appointment
saved in the 'contacts' table. It isn't ideal as a storage for the
relation anyway, because the appointments obviously expire, whereas the
associations between boxes and people should remain accessible...

Quote:
* = Primary Key. Note that the Primary Key on the appointments table is
comprised of all three pieces of information - on the assumption that
nobody can be in the SAME place at the SAME time TWICE! This does not
however preclude the box being, as it were, 'double-booked'. To do
that, the PRIMARY KEY would be comprised solely of the box_id and the
datetime. However, that still wouldn't prevent a contact being
'double-booked' - but I'm going to suggest that that's beyond the scope
of this answer!

I don't know how queries are constructed but let's just assume they're
a bit like MySQL:

SELECT a.datetime,b.box_no,c.contact_name,c.contact_addre ss
FROM appointments a
LEFT JOIN boxes b ON a.box_id = b.box_id
LEFT JOIN contacts c ON a.contact_id = c.contact_id;
Hmm, I could use SQL to build a query, but I'd need to get the field
names right - and I need to get the proper relations first...


Quote:
HIH
Very much appreciated!

Berti



Reply With Quote
  #4  
Old   
AT
 
Posts: n/a

Default Re: Openoffice Base: Right way for a relation - 08-07-2006 , 07:49 PM




Quote:
Hmm, I could use SQL to build a query, but I'd need to get the field
names right - and I need to get the proper relations first...


HIH

Very much appreciated!

Berti
If those were the tables then those would be the fieldnames!!! As for
the relations, they are established in the query itself - 'a.box_id =
b.box_id'.

Transactional databases often have some kind of 'orders' table for
establishing the link between a contact and an item. You could have
something similar, maybe a 'consignments' table if the items aren't
actually 'ordered' - 'appointments' really is a table though, no
matter that it might (just like the boxes and contacts tables) be
populated by a form.

As I said, I really know nothing about OpenOffice - I know that it uses
xml to store these little bits of information but that's about it. FWIW
I do know, however, that you could implement this whole thing in php
and mysql over a long weekend (including the self-populating forms) -
with the help of a couple of decent books on the subject and some
online tutorials! Then you'd have the bonus of having the whole thing
accessible over the web and direct to your delivery guy's blackberry.
OK, maybe a little more than a weekend, but you get the idea.



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.