Jump to content
Sign in to follow this  
Sima2004

add sth. to a table in many-many relationship

Recommended Posts

Hello everybody,

My problem is as follows:

I have three tables named (paper, journalist, join) and a many to many relationship. The join table is a join between the two main tables.

It is now too difficult to add something to or delete something from the tables. Each time that the user want to add sth. he should memorize the key of the wanted record in paper table and the key of the wanted record in journalist table and in order to make a relation between these two records he should make a new record in the join table and add the keys to that record, the information of both records from the main tables come in to this new record in the join table via cal. fields. This is ofcourse not user friendly, it takes too much time to add sth. to the tables and u can make very fast an error, if u type the key not correctly then u make a wrong relation.

What i'm searching for is a way( a script or sth else)to make it more easy and direct for user, i was thinking of two buttons on both main tables to do that add process for the user without the necessity of going to the join table.

Is that possible? Has somebody a suggestion for me?

Thanks,

Share this post


Link to post
Share on other sites

Use portals with value lists. FM will automatically insert the correct keys.

Share this post


Link to post
Share on other sites

Hi, Sima. You are on the right track with the script idea. It can be a very simple script. One possibility:

A global text field named, say, choosePaper. Relate that field to paperName in the Paper file.

User enters a paper name into choosePaper (or, better yet, selects it from a value list) and clicks a button labelled "LookUp."

This button triggers a script that sets the appropriate join table field to the ID number matched by that paper name.

I'll be happy to post an example of this if i left out any details.

HTH,

Jerry

Share this post


Link to post
Share on other sites

Hi Jerry,

Thanks for your answer.I would be very happy if i can see the example.

So i should make a global field where in the join table?

Share this post


Link to post
Share on other sites

The global field should be in the journalists file (or wherever you're originating the request from--in the attached example, it's the journ.fp5 file).

J

sima2004.zip

Share this post


Link to post
Share on other sites

Tahnk you very much Jerry,

I have one more question. Is that possible to add a new paper in to that value list sothat you don't have to go to the table paper and then make a record for new paper and then come back to the journalist and add the paper to that journalist? Can that be done more directly?

Share this post


Link to post
Share on other sites

Well, if you have a statically-defined value list, you can use the "Edit..." option to do this. However, if you have a value list based on the contents of another field, unfortunately no, this is not possible. Your best method will be to go to the Paper file and create a new record in the usual way.

J

Share this post


Link to post
Share on other sites

Hi,

I've got a new idea. I want to save the keys in a variable and use them in join tabel and make a new record there to make a relation between these two records. Is that possible?

Thanks,

Share this post


Link to post
Share on other sites

Come again? I'm not sure what you're proposing.

save the keys in a variable

What do you mean?

use them in join tabel and make a new record there to make a relation between these two records

Isn't this what you're already doing?

J

Share this post


Link to post
Share on other sites

Hi ???-)

What i want is to make it possible that the user adds a journalist from the paper table without she needs to make the link by herself in journalist table. I think that would me more secure if i do that for her. So, i've made a new button named add a new journalist, this button makes a new record in the journalisten table, i wish to add the name of the paper at the same time to the portal and the list. I need to bring the media name with me to the journalist table ( i want a variable to save this key in that variable),save the key of the new record for journalist in another variable, and use another script to set this keys in the join table in de fields media & journalist keys! Or i can use the same script that we used befor to put the media name in the portal.

Am i too boring then?

Share this post


Link to post
Share on other sites

Hi,

Use globals to pass these variables to the other Table.

SetField[JournalistTable::gMediaName,MediaName]

GoTo Layout[JournalistEntry]

NewRecord

SetField[MediaName,Journalit:MediaName]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

By using this site, you agree to our Terms of Use.