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

Compound Key on Active Link Table?

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

  • Compound Key on Active Link Table?

    Is it possible to use compound keys (concatenated fields) to create referential integrity on active linked tables? I've got a Dbase 5 database that I need to be able to link on a read-only basis and use data from in my application but the Dbase files (several) have multi-field keys (Family_ID + Family_Member), (Family_ID + Address_Code) for home, work, other addresses, etc. I've tried using the concatenated fields as expressions in the Set Link but I'm not returning any child data.
    Brad Weaver, President
    ComputerAid International
    Ottawa ON Canada
    Versailles KY USA
    www.compuaid.com

  • #2
    Re: Compound Key on Active Link Table?

    Hi Brad,

    It could be that the fields are not an exact match in the link. Make good use of alltrim().

    I would start off with one field at a time just to prove the link works and then build from there.
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

    Comment


    • #3
      Re: Compound Key on Active Link Table?

      I've been able to link the tables using only one of the two fields but when I attempt to link using an expression i.e. Trim(Family_ID) = Trim(Family_ID) I'm told that the expression cannot be converted to SQL. As I've said, when I attempt to concatenate the two fields to create a compound key the program does not return any records in the default browse. If I'm unable to accomplish the simple task of using a compound primary key then I'll have to move back to FoxPro or Access I'm afraid. That would be a shame as I am just starting to really like Alpha and hoped it could be my new primary development environment - especially with all the new features coming in version 10.
      Brad Weaver, President
      ComputerAid International
      Ottawa ON Canada
      Versailles KY USA
      www.compuaid.com

      Comment


      • #4
        Re: Compound Key on Active Link Table?

        Okay, I tried a different approach. Since the tables I'm linking to are not required to be updated from within Alpha 5 I used Passive Link tables instead and the sets built on multiple keys from those appears to work. I used exactly the same ODBC drivers and settings and again tried with Active link and it doesn't function so I'm going to chalk this up as a problem with Active Link in A5V9 using multi-field keys. I'll send it off as a bug and just try doing a programmatic refresh of the passive link tables on a regular basis.
        Brad Weaver, President
        ComputerAid International
        Ottawa ON Canada
        Versailles KY USA
        www.compuaid.com

        Comment


        • #5
          Re: Compound Key on Active Link Table?

          I've found that if using multiple tables linked by compound keys that even using Passive Link Alpha seems to not be able to resolve the relations. Here's my situation:

          I am trying to link to four Dbase 5 tables on a read-only basis. The tables are defined as such:


          Family – primary key FAMILY_ID

          F_Members – primary key FAMILY_ID+MEMB_ID
          - foreign key FAMILY_ID into FAMILY table (1-many)


          Addr – primary key FAMILY_ID+MEMB_ID+ADDR_CODE
          - foreign key FAMILY_ID+MEMB_ID into F_MEMBERS table (1-many)


          Addresses – primary key FAMILY_ID+ADDR_CODE
          - foreign key FAMILY_ID+ADDR_CODE into ADDR (1-1)


          When I link any two tables using only a single key (i.e. Family_ID) the sets populate with no problem. When I change the keys to expressions using compound keys (i.e. Family_ID+Memb_ID) the program returns no data. I have been able to
          successfully link tables with compound keys if I use Passive Link tables so the set design is correct.


          Also, I am unable to create sets based on passive links for the same data above if multiple tables are linked using compound keys. No data is returned for the child sets of the third and fourth tables. If I use only single field keys (Family_ID for instance) then my rows populate with data from all four tables.



          Family ===> F_Members (Family_ID) ===> Addr (Family_ID+Memb_ID) ---> Addresses (Family_ID+Addr_Code)


          I even tried creating mapped tables and adding calculated fields with the compound keys but when I try to use those as the linking fields Alpha reports that I've used an invalid Primary Key.



          Since I have no control over the structure of the tables I’m linking to (they are defined by a third-party software) I need to be able to use the data referentially in Alpha with compound keys. I am confident of the relationships as I’ve been able
          to create these structures and relations in both Visual FoxPro and MS Access.
          Brad Weaver, President
          ComputerAid International
          Ottawa ON Canada
          Versailles KY USA
          www.compuaid.com

          Comment


          • #6
            Re: Compound Key on Active Link Table?

            Brad,
            The only thing that comes to mind that has not been mentioned is the length of your linkages---there is a 240 character limit. If any exceed these it should cause an error, but check them anyway am thinking (use left() function then to limit if necessary).
            Mike
            __________________________________________
            It is only when we forget all our learning that we begin to know.
            It's not what you look at that matters, it's what you see.
            Henry David Thoreau
            __________________________________________



            Comment


            • #7
              Re: Compound Key on Active Link Table?

              The linkages are all a maximum of 9 characters. Family_ID is 7 characters, Member_ID is two characters. Selwyn replied to my bug report that compound keys are NOT supported on Active Link tables in Alpha. This may be a showstopper for me unless there's a way I can link the tables programmatically in Xbasic and not use Sets.

              Is there a tried and true technique for doing parent-child relations on forms or in Xdialogs in Alpha that does not use Sets but fills fields and grids via Xbasic? What I'd like is to display the Family name and info from the Family table and then have a grid list of all family members (from the associated F_Members table.) When a Family Member is selected I would like to be able to see in a separate grid all addresses on file for that Family member (from the ADDR and ADDRESSES tables - ADDR being the linking table to multiple addresses per family member).
              Brad Weaver, President
              ComputerAid International
              Ottawa ON Canada
              Versailles KY USA
              www.compuaid.com

              Comment


              • #8
                Re: Compound Key on Active Link Table?

                This may be a ODBC driver limitation or it may be an Alpha issue. (This reminds me of a former problem)

                Can you build an example so this can be submitted to Alpha? We(the messageboard) can verify it prior to submitting to Alpha.

                So if you could put together a little package that includes the db5 tables, the ODBC install file, and an Alpha database/tables we can get to the nitty gritty much faster.
                Al Buchholz
                Bookwood Systems, LTD
                Weekly QReportBuilder Webinars Thursday 1 pm CST

                Occam's Razor - KISS
                Normalize till it hurts - De-normalize till it works.
                Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                When we triage a problem it is much easier to read sample systems than to read a mind.
                "Make it as simple as possible, but not simpler."
                Albert Einstein

                http://www.iadn.com/images/media/iadn_member.png

                Comment


                • #9
                  Re: Compound Key on Active Link Table?

                  !!!!!!!!!!!! THIS IS A SHOW STOPPER !!!!!!!!!!!

                  After all the hype about Alpha V9 & its transparent integration with SQL, I committed to update our accounting system to Navision (SQL version).

                  The theory was to finally integrate my custom written app with our accounting system. Of course my app is composed of concatenated keys. Personally, I can't imagine to many complicated applications that don't utilize concatenated keys.

                  Database rules of normalization: 2 nd Normal Form:

                  "Create Separate Tables for Each Element of a Concatenated Key."


                  Having spent 20K, for SQL licenses, base software and modifications, I will NOT be a happy camper if Alpha does not support such a basic concept.

                  Those of us who used A4, remember that it supported concatenated keys with no restrictions, eg. fields did not have to be adjacent, links were automatically created.....Alpha 5 failed to follow this philosophy.

                  Please tell me that this is a tempory restriction.

                  John

                  Comment


                  • #10
                    Re: Compound Key on Active Link Table?

                    I reported this as a bug in A5V9 and the response I got from Selwyn was:

                    "correct. sets based on active-links do not support compound keys."

                    I have abandoned Alpha 5 for my new project and moved back to Visual FoxPro. I'm disappointed that something Microsoft Access, Visual FoxPro and most other database programs handle with ease is dismissed as unsupported in Alpha 5. Most databases that I've encountered make use of compound keys and all databases that use a third linking table between two databases require this ability. Let's hope that Alpha sees the light and adds this ability to V10 or I'm afraid as a true relational database Alpha fails.
                    Last edited by compuaid; 08-17-2009, 07:53 AM. Reason: Formatting
                    Brad Weaver, President
                    ComputerAid International
                    Ottawa ON Canada
                    Versailles KY USA
                    www.compuaid.com

                    Comment


                    • #11
                      Re: Compound Key on Active Link Table?

                      There is only one thing that I can add here that may or may not be relevant. I have found that the joins must be of same type and more imporatntly the same size. If not the integrity is is doomed.

                      Comment


                      • #12
                        Re: Compound Key on Active Link Table?

                        I have not tried this but is just a thought.
                        sets based on active-links do not support compound keys.
                        ...Would it not be possible as a work-around (I know, another suggestion to use a work-around!) such as creating another field that is a concatenation of the two (or more) fields that are needed and use that to link the tables?
                        Mike
                        __________________________________________
                        It is only when we forget all our learning that we begin to know.
                        It's not what you look at that matters, it's what you see.
                        Henry David Thoreau
                        __________________________________________



                        Comment


                        • #13
                          Re: Compound Key on Active Link Table?

                          It's not possible to create a combined field (nor is is proper in database normalization to repeat data) in our case because the tables I'm linking to are part of another application written by a third party so I have no ability to modify their table structures or update their data.
                          Brad Weaver, President
                          ComputerAid International
                          Ottawa ON Canada
                          Versailles KY USA
                          www.compuaid.com

                          Comment


                          • #14
                            Re: Compound Key on Active Link Table?

                            Hi Brad,
                            My thought was that perhaps the issue was on the Alpha side as the compound key must already be present on the "other" side...not knowing your exact scenario simply brought a guess out of me!!
                            Mike
                            __________________________________________
                            It is only when we forget all our learning that we begin to know.
                            It's not what you look at that matters, it's what you see.
                            Henry David Thoreau
                            __________________________________________



                            Comment


                            • #15
                              Re: Compound Key on Active Link Table?

                              hi brad, all my table are in sql 2008 100%
                              in your situation, i create "view" with the matching field name
                              and avoid going to the real table?

                              is this something that may solve your issue?
                              i am in vancouver by the way.

                              Comment

                              Working...
                              X