Link more than one field in 2 databases

This forum is for application developers who are integrating HanDBase into their solutions via the HanDBase API (HAPI) or other means. It's also a great place to discuss runtime development.

Link more than one field in 2 databases

Postby chuxtable » Mon Apr 01, 2013 10:52 pm

Hi,
I was wondering if there is a way to link 2 or more fields in 2 different databases at the same time. I have a main database which is linked to another, subsidiary database. When the link is activated, I want the subsidiary database to show the contents of 2 fields from the main database in 2 identically-named fields in the subsidiary database. More explicitly, my main database includes (among others) two fields called UniqueID and Stratum. My subsidiary database includes (among others) 2 fields with the same names. I want to be able to activate a link which will open the subsidiary database with a new record with the contents of the fields UniqueID and Stratum populated with the contents of the same fields in the Main database.
Is this possible in HanDBase? Any help gratefully received
Charles
chuxtable
 
Posts: 67
Joined: Tue Mar 27, 2012 10:16 pm

Re: Link more than one field in 2 databases

Postby dhaupert » Tue Apr 02, 2013 10:47 am

Hi Charles!

That's what the relationship field is for. In a linked database, if you'd like to see another field from the parent database, you can use the relationship field and set it up as follows:

Field in this database- linked field
Other database- parent database
Other database field - link field
Show from other database- whatever other field you want to show.

You can create a bunch of these if you'd like!

And if you want- in the parent database, you can do the same thing using the link/linked pair and see related data from the child database.
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Link more than one field in 2 databases

Postby chuxtable » Sat Apr 20, 2013 8:34 pm

Hi, I have tried and I still don't understand how to set this up. Is there an example database that could demostrate this please
chuxtable
 
Posts: 67
Joined: Tue Mar 27, 2012 10:16 pm

Re: Link more than one field in 2 databases

Postby galenmd » Sun Apr 28, 2013 11:54 am

I have a similar question:
I am creating a db for a personal trainer. In it, there is a field where he can select a particular exercise that comes from db Pop-up. The exercise DB itself has another db pop-up field called "muscle groups." The data for that field is populated from a db named "muscle groups". This way, if he wants to add a new exercise, he can quickly choose which muscle groups it works on.

Here is the question: If he selects an exercise in the parent database, I would like to have the associated Muscle Groups to appear. When I try several methods, it does not allow me to choose that field. I am sure I am doing something wrong.

Thanks
galenmd
 
Posts: 8
Joined: Tue Sep 01, 2009 8:06 am

Re: Link more than one field in 2 databases

Postby galenmd » Sun Apr 28, 2013 1:22 pm

Never mind. I used your relationship example and managed to select the correct fields. All is working great!
thanks
galenmd
 
Posts: 8
Joined: Tue Sep 01, 2009 8:06 am

Re: Link more than one field in 2 databases

Postby chuxtable » Thu May 02, 2013 12:08 am

Dear HanDBasers, does anyone know how to do what my original query asked? For the life of me I can't figure it out. Dave, I don't understand what you mean in your response - is there a practical example you could give me please? Any help gratefully accepted! Charles
chuxtable
 
Posts: 67
Joined: Tue Mar 27, 2012 10:16 pm

Re: Link more than one field in 2 databases

Postby dhaupert » Thu May 02, 2013 8:03 am

Hi Charles,

I just uploaded a quick and simple example to the gallery. It's a set of databases called Actors and Movies. The main database is actors and there is a first name and last name for each actor. There is a link field to jump to the movies database to show all movies for that actor. The link/linked pair is set up to show the last name from the Actors databases in the Movies database. But then there is a relationship field set up that uses the link/linked as a pair of matching values to grab the first name and show it. You'll see in the setup that the relationship is set to use the:

Related Field in this database: Last Name (the linked field)
Other Database Name: Actors
Field in other database: Movies (the link field of the parent database)
Show from other database: First Name (the field we wanted to show here)
From Which Record: First matching record. (if the parent database had more than a single match, this setting would let you choose whether to take from the first or last matching record. In this case, there should only be one match since it's a one to many relationship and the 'many' (the movies db) is looking in the 'one' (the actors db) for a match.

I hope this makes sense. Here's the link to the entry:
http://ddhsoftware.com/gallery.html?sho ... ecord=4775
dhaupert
 
Posts: 4111
Joined: Tue May 26, 2009 11:51 am

Re: Link more than one field in 2 databases

Postby chuxtable » Thu May 02, 2013 10:36 pm

Hi Dave, thanks very much! That's exactly what I needed and solves my problem completely. Regards Charles
chuxtable
 
Posts: 67
Joined: Tue Mar 27, 2012 10:16 pm


Return to HanDBase - Developers

Who is online

Users browsing this forum: No registered users and 0 guests

cron