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

Problems with Referntial Integrity

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

    Problems with Referntial Integrity

    Trying to create a one_to_many set with two links to the same table;
    Parent is 'Appendix_c' while child is 'Logging'
    my links are:
    appendix_c->unique = logging->op_unique
    appendix_c->base_unique = logging->base_unique
    A5 happily did all this with no errors, I then tried to set 'Referential Integrity' to 'cascade changes/deletes'
    and saved the set.

    When I try and open a form on this set I get the following message twice, presumably for each link.

    Error loading test_fleets.set
    Error adding relation child 'Logging'; for integrity, use parent field name
    cannot work out what A5 is trying to tell me!!

    any suggestions welcomed
    --
    Support your local Search and Rescue Unit, Get Lost!

    www.westrowops.co.uk

    #2
    Re: Problems with Referntial Integrity

    Alpha should have assigned an alias to the 2nd instance of the same table. If you tried to set RI to child both tables that is probably why you are getting the error. Other than that it sounds like the field you are linking on is probably wrong.

    So why the 2 instances of the same table?
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

    Comment


      #3
      Re: Problems with Referntial Integrity

      Originally posted by MoGrace View Post
      Alpha should have assigned an alias to the 2nd instance of the same table. If you tried to set RI to child both tables that is probably why you are getting the error. Other than that it sounds like the field you are linking on is probably wrong.

      So why the 2 instances of the same table?
      maybe I explained it wrong, I am trying to link the two tables using two fields rather than two links. I have used one-to-many sets for years but have never been able to get the Referential Integrity part to work.
      appendix_c->Unique is a underlying unique number for a field 'Operator' which contains name of an aircraft operator, which can be changed, but not the unique
      appendix_c->base_unique is also an underlying unique for the 'Home base' of the aircraft used by the 'Operator'.
      When I change the appendix_c->base_unique (.ie the operator moves to a different location), I also need to change the 'Home Base' in the logging->base_unique field, to keep the operators fleet in sync.
      I've 'sort-of' got it to work by only having one link on appendix-c->unique/logging->op_unique and then attaching the following script to the 'ON_CHANGE' event of the appendix_c->base_unique field:
      t = table.open("logging")
      query.filter = "op_unique = "-quote(Appendix_C->Unique)
      query.order = "recno()"
      t.query_create()
      t.fetch_first()
      while .not. t.fetch_eof()
      t.change_begin()
      t.base_unique = appendix_c->Base_unique
      t.change_end(.t.)
      t.fetch_next()
      end while
      topparent:Control_browse1.refresh()
      two problems arise:
      1) I sometimes get record locking problems
      2) If I change my mind and cancel the change in appendix_c->base_unique the script has already changed logging->base_unique so the two tables become un-synched.
      --
      Support your local Search and Rescue Unit, Get Lost!

      www.westrowops.co.uk

      Comment


        #4
        Re: Problems with Referntial Integrity

        Can you simplify the table and set construction and repost please Graham?
        If the operator number and home base are in the same table there should not be an issue.
        Your description of the problem is a little confusing, to me anyway.
        See our Hybrid Option here;
        https://hybridapps.example-software.com/


        Apologies to anyone I haven't managed to upset yet.
        You are held in a queue and I will get to you soon.

        Comment


          #5
          Re: Problems with Referntial Integrity

          Originally posted by Ted Giles View Post
          Can you simplify the table and set construction and repost please Graham?
          If the operator number and home base are in the same table there should not be an issue.
          Your description of the problem is a little confusing, to me anyway.
          Attached Files
          --
          Support your local Search and Rescue Unit, Get Lost!

          www.westrowops.co.uk

          Comment


            #6
            Re: Problems with Referntial Integrity

            Not sure what you are trying to achieve. The uploaded example failed due to unrecognised field in the set browse.

            I have tried to understand what you need but failed.

            Can you write it in simple format like pseudo code?
            What needs changing and when would be good.
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            Apologies to anyone I haven't managed to upset yet.
            You are held in a queue and I will get to you soon.

            Comment


              #7
              Re: Problems with Referntial Integrity

              I have three main tables:

              1) Appendix_C (Test_operator_name in example)
              Data on Aircraft Operators, name, home base, insignia, nicknames etc

              2) Base_Details (Test_Base Details )
              Data on Airfields, Name, placename, airfield information etc

              3) Logging (Test Logging)
              Data on Aircraft, Type, name location , owner/operator etc

              plus many small tables containing all the look-up values for use in the big three.

              One-to-many set Test_Fleets has Test_operator_name as Parent and Test_Logging as child. with the link on Test_operator_name->Unique to Test_Logging->op_unique.
              The problem occurs when I need to change the Parent (Test_operator_name->base_unique) value as I also need to change Test_logging->base_unique to the same value for the child records so that Test_logging entries are still in sync.

              I was hoping referential Integrity would do the trick by using both test_operator_name->unique/test_logging->op_unique AND test_operator_name->base_unique/test_logging->base unique as the link between Parent and child, but A5 doesnt like it.

              I have got around this by adding the following script to the ONCHANGE event on Test_operator_name->base_unique:

              t = table.open("test_logging")
              query.filter = "op_unique = "-quote(TEST_OPERATOR_NAME->Unique)
              query.order = "recno()"
              t.query_create()
              t.fetch_first()
              while .not. t.fetch_eof()
              t.change_begin()
              t.base_unique = TEST_OPERATOR_NAME->Base_unique
              t.change_end(.t.)
              t.fetch_next()
              end while
              topparent:browse1.refresh()
              this works most of the time, but two problems occur:

              1) record locks
              2) If I cancel the change, it does not change the child records back.

              Corrected zip attached
              Attached Files
              --
              Support your local Search and Rescue Unit, Get Lost!

              www.westrowops.co.uk

              Comment


                #8
                Re: Problems with Referntial Integrity

                Graham,

                The code is missing "table.close()" and "qry.drop()" in your code and i could not find where did you apply it in your sample?

                Comment


                  #9
                  Re: Problems with Referntial Integrity

                  That is an issue with the code, certainly.
                  However, I suspect it's more to do with the Set design.
                  I'm working today but was planning to revisit later and try a different Set configuration.
                  Simplifying the PK and/or linking field name with standardisation could also enable a 1 to 3 and 3 to 2 (above) Set.
                  See our Hybrid Option here;
                  https://hybridapps.example-software.com/


                  Apologies to anyone I haven't managed to upset yet.
                  You are held in a queue and I will get to you soon.

                  Comment


                    #10
                    Re: Problems with Referntial Integrity

                    Originally posted by Ted Giles View Post
                    That is an issue with the code, certainly.
                    However, I suspect it's more to do with the Set design.
                    I'm working today but was planning to revisit later and try a different Set configuration.
                    Simplifying the PK and/or linking field name with standardisation could also enable a 1 to 3 and 3 to 2 (above) Set.
                    Thanks for your help Ted,

                    abandoned use of RI as it was causing more problems than it solved. I settled on the following code, attached to the ONCHANGE event on the base_unique field on my parent form.

                    t = table.get("logging")
                    query.filter = "op_unique = "-quote(Appendix_C->Unique)
                    query.order = "recno()"
                    qry = t.query_create()
                    t.fetch_first()
                    while .not. t.fetch_eof()
                    t.change_begin()
                    t.base_unique = appendix_c->Base_unique
                    t.change_end(.t.)
                    t.fetch_next()
                    end while
                    qry.drop()
                    seems to do what I want it to do!
                    --
                    Support your local Search and Rescue Unit, Get Lost!

                    www.westrowops.co.uk

                    Comment


                      #11
                      Re: Problems with Referntial Integrity

                      Glad it's working Graham.
                      I spent a while earlier today and it is a bit of a poser.
                      I tried different setting in a set and different configurations and got closer.
                      I'll take this off line as a "challenge" as it should be possible.
                      Will post and PM you if I get it working on my box.
                      See our Hybrid Option here;
                      https://hybridapps.example-software.com/


                      Apologies to anyone I haven't managed to upset yet.
                      You are held in a queue and I will get to you soon.

                      Comment

                      Working...
                      X