Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Many to Many?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Many to Many?

    I have a many to many relationship between Clients which have specific attributes
    and Contacts which are mostly made up of relatives of the client and their contact information.

    I almost immediately get the Spouse to become a client and will then share
    many of the same Contacts. Later down the road other family members may become
    Clients and also share many of the same contacts.
    I donīt really want to have to input all their contact information
    for each client if I already have them in the database. so I need to relate
    various clients to various contacts or individual contacts.
    I set up a client_contact m&m table and then connected the clients and contacts
    on a one to many relation as is suggested in help but reading a little further down the
    help file you get alpha can't display in forms or browse these sets but xbasic can do something
    with them.
    so I need to associate Clients to Contacts so I can say these contacts are for this client.
    I tried to look at the school to classes template but I donīt really understand what they are doing there
    and that is usually a classic display of a many to many there they split the connection between students and m&m table
    and classes at least thats what I think is going on not the same way a m&m is shown in help.
    I am thinking I need to set up some kind of header file or something of clients to contacts or what?
    Any help on this Many to Many Idea and how to handle it in Alpha would be greatly appreciated.
    I really want to know how you use an many to many relationship in alpha if you canīt display the set.
    Thanks

  • #2
    Re: Many to Many?

    I have always thought that description in the help is not quite right.

    Create a new set with the Client table as primary. then add the client_contact table as a child linked 1:M using the client id as the link. Next add the Contact table as a child of the client_contact table using a 1:1 link based on the contact id. This will show you all the contacts for a particular client. If you want to see all clients for a particular contact create another set with the contact table as primary.
    Tim Kiebert
    Eagle Creek Citrus
    A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

    Comment


    • #3
      Re: Many to Many?

      The design for a many to many relationship is implemented through the creation of what is referred to as a bridge entity; this latter breaks the many to many relationship into two one to many relationships. Let's take your example where there is many to many relationship between clients and contacts:

      Let's assume that the client and contact tables have respectively the following primary keys : CLIENT_ID and CONTACT_ID.
      1st you create another table (bridge entity) let's call it: CLIENT_CONTACT whose primary key is the combination of both the client and contact primary keys: (CLIENT_ID,CONTACT_ID)
      Then you link the client table with client_contact table as 1 to many and also link the contact and client_contact as 1 to many.

      That way you would have split the many to many relationship through the creation of the bridge entity client_contact.

      Attached is the database design of the many to many relationship done is MSSQL server.
      CLIENT_CONTACT_BRIDGE_ENTITY.png

      Hope this helps

      Maroine

      Comment


      • #4
        Re: Many to Many?

        Thanks Tim for responding
        This seem to be the way it is done in alpha even though the help files shows something different.
        I can see this method applied in the students to classes template database which is a classic application
        of many to many.

        Comment


        • #5
          Re: Many to Many?

          Thanks Maroine for your input also
          I have seen this set up in the books on database but I sort of donīt know how to use it in alpha
          the help file in alpha presents the same configuration
          Alpha five many to many in help.PNG
          I guess the problem is I donīt really see clearly how to get the information I want from it via xbasic
          What I was doing was using a look up table to find the client associated with the contact and then I would save the contact
          this works fine if there is only one client per contact but now I see that I can have various clients. so my Idea is to some how assign clients to contacts and then be able to filter all the contacs based on the client associated with them.
          I would like to do this by going to the contact table and filtering the contacts by client but this may be impossible
          maybe I could use a client record field or somekind of arrangement like a header saving a new record example from each contact with a different client. rather redundant. As you can see I still have trouble thinking about how relational dbf actually works or how to get it to work
          Thanks Again.

          Comment


          • #6
            Re: Many to Many?

            Ok I set up a test database for this Idea and built two forms one for clients and another for contacts
            I built the Clients form on the Clients 1:M to bridge to 1:1 Contacts set
            and then the Contact form on the Contacts 1:M to bridge to 1:1 Clients set
            I then input a few example records but I donīt understand or see how this works. What have I done wrong?
            As it is I donīt see any relationship occurring.
            client to contacts sets.PNG

            I have also included a zip of the dbf
            I donīt see anything happening in the clients to contacts M&M bridge
            How do I get the form to assign the relationships of client Ids and contact Ids in the bridge.
            I thought this would happen automatically as I input records but that doesnīt seem to happen
            or at least I haven't got it to work

            any observations about this would be greatly appreciated.
            Thanks
            George R. Kenney
            Attached Files

            Comment


            • #7
              Re: Many to Many?

              What version is this built with George?
              I get an error in V10.5 and V9, so is it V11?

              Client Table seems corrupt. Nope, it's fine, it was the cra99y download.
              Ted Giles
              Example Consulting - UK
              .

              sigpichttp://ec12.example-software.com//
              See our site for Alpha Support, Conversion and Upgrade.

              Comment


              • #8
                Re: Many to Many?

                Originally posted by Ted Giles View Post
                What version is this built with George?
                I get an error in V10.5 and V9, so is it V11?

                Client Table seems corrupt. Nope, it's fine, it was the cra99y download.
                I am using v9
                thanks for looking at it

                Comment


                • #9
                  Re: Many to Many?

                  Aah!
                  Spent a while trying to put an easily replicated sample together.
                  More tomorrow.
                  Ted Giles
                  Example Consulting - UK
                  .

                  sigpichttp://ec12.example-software.com//
                  See our site for Alpha Support, Conversion and Upgrade.

                  Comment


                  • #10
                    Re: Many to Many?

                    Couple of issues.
                    1) Using a Char field as a lonk isn't a good idea. Suggest you use Numeric. If you MUST use Char, create a link using Trim(field). This will scupper using Ref Integ in V9. V10.5 allows Ref Int with Expresions.
                    2) You are Auto Incrementing in the Contact Table, so when you add a Contact to the Client record it will be incremented. Not good.
                    3) What you really have is 1:m Clients - Contacts, and 1:m Contacts - Clients.
                    Work your way up from a simple 1:m with a lookup to populate the child table.

                    The Alpha Help Files say that the M:M structure is unsupported by Forms or Browses. Helpful (not)
                    Ted Giles
                    Example Consulting - UK
                    .

                    sigpichttp://ec12.example-software.com//
                    See our site for Alpha Support, Conversion and Upgrade.

                    Comment

                    Working...
                    X