New call-to-action
Results 1 to 9 of 9

Thread: Many to many links in a set, I think?

  1. #1
    Member
    Real Name
    Brian Dennis
    Join Date
    Sep 2001
    Posts
    372

    Default Many to many links in a set, I think?

    I´m making an application for our tool/plant hire company. I´m moving from, what I now think was probably my lash-up in A4, to hopefully something good in A5.

    We have clients; who are either firms, or private people, or something in-between, or sometimes thieves! The private people rent for themselves, so no problem. The firms have authorised people; drivers/supervisors/etc, who they authorize to sign rental contracts.
    So we have the situation sometimes where one firm has several staff, but also some of those people work for more than one firm, or work for themselves on weekends, etc.

    So a many to many set, sometimes both ways?

    So I´m thinking the best way to sort it out is:-

    A set:-
    3 tables:- personlist, firmlist, linklist.

    personlist:- info of person, i.d. personal details etc.
    firmlist:- info of firm, address, tax no, tel/fax, vehicles, etc
    linklist:- a two field table linking persons to firms in both directions as required.

    In the case of a private person, his firm details would be his own address, etc.

    Then, I can make tables giving info of firms with all their staff; and a different table giving info of all the firms that any one person works for. Those are the tables I need to search on when a client wants to rent a machine.

    I would appreciate advice, is this a practical way to deal with our situation, or any other suggestions?

    Brian

  2. #2
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Many to many links in a set, I think?

    Hi again Brian,

    Here is one way to think about this. A many-to-many relation can be decomposed into two two one-to-many relations.

    For example, a student has many teachers and a teacher has many students so teachers to students is a many-to-many relation. This can be analyzed into
    1. Teachers to students 1:N (one to many), and
    2. Students to teachers 1:N.

    Relation #1 is commonly referred to as a classlist and #2 is called a transcript.

    Of course in a real academic records operation the setup would be much more complex but stripped down to the essentials we could capture both of the above relations using the same three tables:

    1-teachers
    2-students
    3-teacher-student

    The latter would contain a record for each teacher-student combination.

    Relation #1 above would consist of table 1 linked 1:N to table 2 which would link 1:1 to table 3;
    Relation #2 above would consist of table 3 linked 1:N to table 2 linked 1:1 to table 1.

    To me this looks similar to what you are suggesting except you are trying to get by with a single set whereas I would recommend two.

    Bill

  3. #3
    Volunteer Moderator
    Real Name
    James A. Talbott, Jr.
    Join Date
    Apr 2000
    Location
    Lexington, KY
    Posts
    1,492

    Default RE: Many to many links in a set, I think?

    Instead of a many to many link, I think I would make a one to one link. What I mean is a:

    header linked with personlist linked one to one with organization (even if the organization they represent is themselves)

    or you could link the header with an organization with a personlist (once again, the organization could be "Themself".)

    I guess it depends on who bears the most responsibility to return the tool, the person or the organization.

    Additionally, the organization could be a one to many set with a list of individuals, and calling in the organization could allow you to lookup a list of people related to that organization (and that organization only).

    Regards,

    Jay Talbott

  4. #4
    Volunteer Moderator Peter.Greulich's Avatar
    Real Name
    Peter Greulich
    Join Date
    Apr 2000
    Location
    Boston, MA
    Posts
    11,656

    Default RE: Many to many links in a set, I think?

    Bill, you lost me:

    1-teachers
    2-students
    3-teacher-student

    Are you saying that table #3 consists of the student's name and the teacher's name? OR, doee #3 consist of the teacher_id & student_id? My understanding is that the latter is correct, resulting in two possible sets:

    Set No. 1
    Teachers[1:N]teacher-student[1:1]students

    Set No. 2
    students[1:N]teacher-student[1:1]Teachers

    Thus, allowing any number of teachers to be linked to any number of students (Set No. 1) and visa-versa (Set No. 2).

    - No?

    Peter

  5. #5
    Member
    Real Name
    Allen Klimeck
    Join Date
    Apr 2000
    Location
    Colorado
    Posts
    549

    Default RE: Many to many links in a set, I think?

    Brian
    You don't need a many to many link. I run a small equipment rental center with A5v4.5. All you need to do is to link your contract one to one with your customer table twice. Link contract to equipmentitem one to many and equipmentitem one to one to equipmentrate. This is demonstrated in the attachment. The rental form was made for a screen resolution of 1024X768 or higher.

  6. #6
    "Certified" Alphaholic
    Real Name
    William Hanigsberg
    Join Date
    Apr 2000
    Location
    Toronto, ON
    Posts
    4,018

    Default RE: Many to many links in a set, I think?

    Hi Peter,

    What you wrote is what I intended to say. Table #3 is just a linking table with identifiers for teacher and student although in practice it is sometimes nice to have a lastname field in there (calculated of course)so a person can make sense of the table in troubleshooting.

    Sorry for the ambiguity. By the time I wrote I had been grading exams all day and had few untainted neurons left at my disposal.

    Bill

  7. #7
    Member
    Real Name
    Brian Dennis
    Join Date
    Sep 2001
    Posts
    372

    Default RE: Many to many links in a set, I think?

    Thanks to all of you for your help.

    I think now that the idea has sunk into my mind that I can do the application. It is just a big rethink from what I was doing before.
    Thanks to everybody, I might just need some more advise in the future: computors to me are like dentists; the only worse thing than going to a dentist, is not being able to get to a dentist.

    Brian.

  8. #8
    Member
    Real Name
    Brian Dennis
    Join Date
    Sep 2001
    Posts
    372

    Default RE: Many to many links in a set, I think?

    Allen,

    Thanks for the help.
    I have tried that in the past and it worked fine in Alpha4 for us for many years. Now our old computor, or maybe it´s software, (or maybe it´s owner) is getting cranky. We are having corrupt files messages/failures. It is always the part of the application which has our most complicated set, it uses a file as parent with child set called 3 times, each of which calls the same child set possibly 3 times, lots of calculated fields, etc. Recently, I went thru and added all the calculated fields the make the "Euro" thing work with the same forms and layouts; that might have made the ultimate difference, but I am usually willing to blame things on the Euro!
    Reading thru the help from this message board, I think that I was doing something basically wrong in the way I made the application; althought it did work, it was from luck. I think now that our computor is getting more full, and the luck is running out; so we are having problems. Hopefully I can get our new application running ok before everything crashes around my ears. It is also true that nobody said in the instructions:- don´t have multiple child db´s/sets using the same db.
    In comparison, fixing a hire machine is simple ! is´nt it?
    Our company is in Portugal, and very small. I reckon Alpha stopped us having to employ extra staff, so it´s paid for itself. May it continue to do so.

    Brian.

  9. #9
    Member
    Real Name
    Brian Dennis
    Join Date
    Sep 2001
    Posts
    372

    Default RE: Many to many links in a set, I think?

    Bill,
    Thanks for the help.
    I will the making up our application along those ideas. I guess one thought which occurs is that the linking table is like gold, lose it for any reason and the whole lot goes. But I suppose that is true of most software.
    Thanks again to all you guys who know these things. If I had realised this approx 1988, our company wld be much better off now.

    Brian.

Similar Threads

  1. Too many links in a set
    By Daniel King in forum Alpha Five Version 5
    Replies: 7
    Last Post: 08-19-2003, 12:56 PM
  2. Links
    By Terry Mudge in forum Alpha Five Version 4
    Replies: 5
    Last Post: 09-24-2002, 12:23 PM
  3. Set links misbehave
    By Stephen Williams in forum Alpha Five Version 4
    Replies: 2
    Last Post: 03-07-2002, 07:34 AM
  4. Set Links don't work??
    By Bob Kieffer in forum Alpha Five Version 4
    Replies: 1
    Last Post: 08-06-2001, 04:26 PM
  5. BAD LINKS
    By Hendrik Krosschell in forum Alpha Five Version 4
    Replies: 4
    Last Post: 01-18-2001, 04:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •