Realtionship problem

Hi I=B4m a new to this database world and I=B4m trying to build a simple
database with two tables. One is with contacts, the other with notes
pictures etc.
I=B4ve made contact Id number fields in both tables and made relations
between them.
I wanted the contact field to be auto enter serial and when created to
let the database create record for this contact in the other table.
The "problem" I have had is that the only way I=B4ve been able to make
this relationship work: Is in the field/control setup to let the Id
field(in contact table) display data from the other table ID field
and the ID field in the other table to display data from the contact
table Id number.
When this is done the auto serial number does not come in directly
just when I type some number like 333 but the record in the notes
table is created correctly.
When I set the field contact Id to display data from contacts table
and Id field the auto number comes in when I choose new record but no
new record is made in the notes table.

Could someone help me with this newbee problem?
What is the best method?
Hope you understand all this....

Best regards HJS
hjalmar74 [ Mo, 17 September 2007 00:40 ] [ ID #1822303 ]

Re: Realtionship problem

In article <1189982421.077293.247260 [at] 57g2000hsv.googlegroups.com>,
hjalmar74 [at] simnet.is wrote:

> Hi I´m a new to this database world and I´m trying to build a simple
> database with two tables. One is with contacts, the other with notes
> pictures etc.
> I´ve made contact Id number fields in both tables and made relations
> between them.
> I wanted the contact field to be auto enter serial and when created to
> let the database create record for this contact in the other table.
> The "problem" I have had is that the only way I´ve been able to make
> this relationship work: Is in the field/control setup to let the Id
> field(in contact table) display data from the other table ID field
> and the ID field in the other table to display data from the contact
> table Id number.
> When this is done the auto serial number does not come in directly
> just when I type some number like 333 but the record in the notes
> table is created correctly.
> When I set the field contact Id to display data from contacts table
> and Id field the auto number comes in when I choose new record but no
> new record is made in the notes table.
>
> Could someone help me with this newbee problem?
> What is the best method?
> Hope you understand all this....
>
> Best regards HJS

First, why do you need two tables? Multiple pictures for each contact?

Assuming you do need two tables, let's call them Contact and Picture.

Each will have an automatic serial number field, so that when a record
is created in that table, a new serial number will be assigned. Call
these kpContactID and kpPictureID (kp signifying that these are the
primary key fields of each table)

The Picture table also needs a number field to hold kfContactID (kf
meaning that it is a key to the foreign table Contacts.)

The relationship then is
Contact::kpContactID = Picture::kfContactID

(The notation Contact::kpContactID means that this field belongs to the
Contact table, end so on)

Of course each table would have other fields. In the Contact table for
example you would need name and address fields. In the Picture table you
wold need a container field for the Picture, and text and date fields
for information about the picture.

Set up the relationship described above to allow creation of records in
the Picture table from the Contact table.

Make a layout of the Contact table that has a portal to the Picture
table. Define the portal to have a convenient number of rows. In the
portal, put some fields to identify the picture, such as date and other
descriptive information. You can also put the container field in the
portal to show the picture, though doing that may slow down the
performance of the database. Also put a button in the portal row to take
you to the related picture record.

Now you can create a new Picture record directly in the portal. The
Picture record thus created would automatically get the appropriate
value of kpContactID assigned to the field Picture::kfContactID, and
thus would be connected to that specific Contact record.

You would have to insert the picture into the container field after you
create the picture record.

Hope this helps.

--
For email, change <fake> to <earthlink>
Bill Collins
bill [ Mo, 17 September 2007 03:27 ] [ ID #1822304 ]

Re: Realtionship problem

Thanks for this reply I think I was able to do this as you described
and I think it worked right. Am I not understanding right that the
record in I the picture table is created only in the contact layout by
for instance typing in a note field in the portal or other field there
from the picture table?

I Have other question if I may ask. The intension of my database
build is to make a little patient database.
I=B4ve seen in the FM homepage a free file called home care. There you
can type in a contact and you have buttons on the one site that takes
you to the examination sheet, medication sheet etc of this patient.

This is actually what I would want to be able to do without going
through the portal phase just click on the button. Is this possible or
would I have to do some sub steps first.
Assuming that I have different tables like contact, examination, etc.

Thanks HJS

Bill wrote:
> In article <1189982421.077293.247260 [at] 57g2000hsv.googlegroups.com>,
> hjalmar74 [at] simnet.is wrote:
>
> > Hi I=B4m a new to this database world and I=B4m trying to build a simp=
le
> > database with two tables. One is with contacts, the other with notes
> > pictures etc.
> > I=B4ve made contact Id number fields in both tables and made relations
> > between them.
> > I wanted the contact field to be auto enter serial and when created to
> > let the database create record for this contact in the other table.
> > The "problem" I have had is that the only way I=B4ve been able to make
> > this relationship work: Is in the field/control setup to let the Id
> > field(in contact table) display data from the other table ID field
> > and the ID field in the other table to display data from the contact
> > table Id number.
> > When this is done the auto serial number does not come in directly
> > just when I type some number like 333 but the record in the notes
> > table is created correctly.
> > When I set the field contact Id to display data from contacts table
> > and Id field the auto number comes in when I choose new record but no
> > new record is made in the notes table.
> >
> > Could someone help me with this newbee problem?
> > What is the best method?
> > Hope you understand all this....
> >
> > Best regards HJS
>
> First, why do you need two tables? Multiple pictures for each contact?
>
> Assuming you do need two tables, let's call them Contact and Picture.
>
> Each will have an automatic serial number field, so that when a record
> is created in that table, a new serial number will be assigned. Call
> these kpContactID and kpPictureID (kp signifying that these are the
> primary key fields of each table)
>
> The Picture table also needs a number field to hold kfContactID (kf
> meaning that it is a key to the foreign table Contacts.)
>
> The relationship then is
> Contact::kpContactID =3D Picture::kfContactID
>
> (The notation Contact::kpContactID means that this field belongs to the
> Contact table, end so on)
>
> Of course each table would have other fields. In the Contact table for
> example you would need name and address fields. In the Picture table you
> wold need a container field for the Picture, and text and date fields
> for information about the picture.
>
> Set up the relationship described above to allow creation of records in
> the Picture table from the Contact table.
>
> Make a layout of the Contact table that has a portal to the Picture
> table. Define the portal to have a convenient number of rows. In the
> portal, put some fields to identify the picture, such as date and other
> descriptive information. You can also put the container field in the
> portal to show the picture, though doing that may slow down the
> performance of the database. Also put a button in the portal row to take
> you to the related picture record.
>
> Now you can create a new Picture record directly in the portal. The
> Picture record thus created would automatically get the appropriate
> value of kpContactID assigned to the field Picture::kfContactID, and
> thus would be connected to that specific Contact record.
>
> You would have to insert the picture into the container field after you
> create the picture record.
>
> Hope this helps.
>
> --
> For email, change <fake> to <earthlink>
> Bill Collins
hjalmar74 [ Mi, 19 September 2007 00:40 ] [ ID #1824088 ]

Re: Realtionship problem

Yes, that is all possible. It is a matter of writing suitable scripts
and assigning those scripts to pushbuttons. A wide variety of setups for
data entry and reporting are possible.

You might want to study the structure of the sample database you
mentioned, Home Care. Study the table structure, fields, relationships,
scripts and layouts. That should be instructive for you and help you in
developing your own database solution.

In article <1190155204.744499.90070 [at] 57g2000hsv.googlegroups.com>,
hjalmar74 [at] simnet.is wrote:

> Thanks for this reply I think I was able to do this as you described
> and I think it worked right. Am I not understanding right that the
> record in I the picture table is created only in the contact layout by
> for instance typing in a note field in the portal or other field there
> from the picture table?
>
> I Have other question if I may ask. The intension of my database
> build is to make a little patient database.
> I´ve seen in the FM homepage a free file called home care. There you
> can type in a contact and you have buttons on the one site that takes
> you to the examination sheet, medication sheet etc of this patient.
>
> This is actually what I would want to be able to do without going
> through the portal phase just click on the button. Is this possible or
> would I have to do some sub steps first.
> Assuming that I have different tables like contact, examination, etc.
>
> Thanks HJS
>
> Bill wrote:
> > In article <1189982421.077293.247260 [at] 57g2000hsv.googlegroups.com>,
> > hjalmar74 [at] simnet.is wrote:
> >
> > > Hi I´m a new to this database world and I´m trying to build a simple
> > > database with two tables. One is with contacts, the other with notes
> > > pictures etc.
> > > I´ve made contact Id number fields in both tables and made relations
> > > between them.
> > > I wanted the contact field to be auto enter serial and when created to
> > > let the database create record for this contact in the other table.
> > > The "problem" I have had is that the only way I´ve been able to make
> > > this relationship work: Is in the field/control setup to let the Id
> > > field(in contact table) display data from the other table ID field
> > > and the ID field in the other table to display data from the contact
> > > table Id number.
> > > When this is done the auto serial number does not come in directly
> > > just when I type some number like 333 but the record in the notes
> > > table is created correctly.
> > > When I set the field contact Id to display data from contacts table
> > > and Id field the auto number comes in when I choose new record but no
> > > new record is made in the notes table.
> > >
> > > Could someone help me with this newbee problem?
> > > What is the best method?
> > > Hope you understand all this....
> > >
> > > Best regards HJS
> >
> > First, why do you need two tables? Multiple pictures for each contact?
> >
> > Assuming you do need two tables, let's call them Contact and Picture.
> >
> > Each will have an automatic serial number field, so that when a record
> > is created in that table, a new serial number will be assigned. Call
> > these kpContactID and kpPictureID (kp signifying that these are the
> > primary key fields of each table)
> >
> > The Picture table also needs a number field to hold kfContactID (kf
> > meaning that it is a key to the foreign table Contacts.)
> >
> > The relationship then is
> > Contact::kpContactID = Picture::kfContactID
> >
> > (The notation Contact::kpContactID means that this field belongs to the
> > Contact table, end so on)
> >
> > Of course each table would have other fields. In the Contact table for
> > example you would need name and address fields. In the Picture table you
> > wold need a container field for the Picture, and text and date fields
> > for information about the picture.
> >
> > Set up the relationship described above to allow creation of records in
> > the Picture table from the Contact table.
> >
> > Make a layout of the Contact table that has a portal to the Picture
> > table. Define the portal to have a convenient number of rows. In the
> > portal, put some fields to identify the picture, such as date and other
> > descriptive information. You can also put the container field in the
> > portal to show the picture, though doing that may slow down the
> > performance of the database. Also put a button in the portal row to take
> > you to the related picture record.
> >
> > Now you can create a new Picture record directly in the portal. The
> > Picture record thus created would automatically get the appropriate
> > value of kpContactID assigned to the field Picture::kfContactID, and
> > thus would be connected to that specific Contact record.
> >
> > You would have to insert the picture into the container field after you
> > create the picture record.
> >
> > Hope this helps.
> >
> > --
> > For email, change <fake> to <earthlink>
> > Bill Collins

--
For email, change <fake> to <earthlink>
Bill Collins
bill [ Mi, 19 September 2007 05:19 ] [ ID #1824092 ]
Datenbanken » comp.databases.filemaker » Realtionship problem

Vorheriges Thema: Designing a monthly calendar in FM 8.5?
Nächstes Thema: Re: old filemaker 3