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

Simple set problems

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

    Simple set problems

    My app records the results of numerous blood tests for an individual. Each type of test has its own table that consists of 3 fields:

    A date
    A time
    A number

    I created a set with the individual's table as the primary and each of the test result tables as the children. The individual's table record also has a date in it, and so I used that as the parent key to the date in each different child table as the child key.

    It is a one-to-many link with no referential integrity since the date in the primary table has no relation to the children. Just using it as the key.

    There are many results for each individual test, but what I am having a problem with is trying to display the last result of each individual test all on the same form.

    I created a form using the primary table as the form table, with the children's date, time and number fields on the form.

    Then I went nuts wasting time trying to fill the form.

    I created a script whose intent is to fetch the last record of each child table so and display it. I have tried 4 different ways shown in the V7 docs, but cannot get any one to work. In every version I get the error:

    Parent table restricted: refetching

    while trying to fetch the last record. Here is a test script for just one child:

    'Load Last Value of Blood Tests
    dim s as P
    dim child_tbl as P

    'Get pointer to primary table of set
    s = set.open_session("test values")

    'Get pointer to the albumin table
    p1 = s.albumin
    p1.fetch_last()

    s.close()

    the p1.fetch_last() causes the error no matter how many ways I code that "fetch_last" command.

    I am calling the script from the OnFetch event for the form.

    Your expression of all-knowing wisdom is highly appreciated, as always... :)
    Richard

    #2
    Re: Simple set problems

    Hi Richard,

    First I do not think using a date field is wise...I would think that many times the same date would occur for many records unless, of course, you plan on entering in only one record per day? I would create another character field in which to link records with some type of auto-increment.

    I would try putting your script on the OnInit event instead of the OnFetch...I have many times experienced a myriad of errors when using OnFetch and simply by changing it to the OnInit or even OnActivate have eliminated the problems while still being able to accomplish what I needed to do. I have not yet discovered what the problem is with the OnFetch event and obviously have used it incorrectly myself ....

    Just some thoughts from a complete novice!

    Mike
    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


      #3
      Re: Simple set problems

      Mike,

      Actually the date in the primary table is 01/01/2000 and is just used for this one purpose. That date can never occur in the tests. Just needed a common field to link on.

      And I initially had the script OnInit, but it didn't work there, so I tried it OnFetch. I just moved it back, to no avail.

      Thanks for the input, though.
      Richard

      Comment


        #4
        Re: Simple set problems

        Richard,

        Again, this is from a novice but did notice a couple of things...


        Code:
        'Load Last Value of Blood Tests
        dim s as P
        dim child_tbl as P  ' [COLOR="Red"]dimmed but not used later on such as to get the child---such as child_tbl=table.get("albumin")[/COLOR]
        
        'Get pointer to primary table of set
        s = set.open_session("test values")  
        
        'Get pointer to the albumin table
        p1 = s.albumin  [COLOR="red"]'any pointer has to be dimmed--see no reference to p1[/COLOR]
        p1.fetch_last()
        
        s.close()

        Mike
        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


          #5
          Re: Simple set problems

          Richard:
          No need for any xbasic.
          In the set structure, sort the child records descending, using the test date field.

          Comment


            #6
            Re: Simple set problems

            Richard,

            Could you give a bit more detail on your set structure and also on the form. ie how are you displaying the 'Last record' ? Is it in an embedded browse or are you just putting the child table fields directly on the form.

            Since this app is to record personal info is it the case that there is only one record in the 'Individual' table?

            A couple of your statements don't make sense to me.

            I created a set with the individual's table as the primary and each of the test result tables as the children. The individual's table record also has a date in it, and so I used that as the parent key to the date in each different child table as the child key.
            It is a one-to-many link with no referential integrity since the date in the primary table has no relation to the children. Just using it as the key.
            The point of a set is to link tables together that are related somehow. If the date in the primary table has no relation to the child tables and that is your linking key how is that suppose to work.
            Actually the date in the primary table is 01/01/2000 and is just used for this one purpose. That date can never occur in the tests. Just needed a common field to link on.
            You may have left something out in you description because from the above if the date of 01/01/2000 in the primary table never occurs in any of the test tables records then you will never have a match on any records.


            Pre-empting any answers you may provide I would...
            1. Add a person_Id field (to the individual and test tables) and use that as the link to your sets (as Mike suggested) (This would also allow you to use the app for multiple individuals in case a parent wanted to record children info to carry with them.)
            2. If the purpose of this particular form is to show the most reason record for a test then make a new set that uses a 1:1 on last matching record and set the Child order to cdate(yourdatefield). Then base the form on this set and just place the fields directly on the form(no embedded browse.)
            3. you can still use the 1:many set as the basis for a form that shows many tests in a browse.
            Last edited by Tim Kiebert; 12-16-2006, 10:34 PM.
            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


              #7
              Re: Simple set problems

              Tim Did a good job helping you!

              I do my connection with an acct field wit a one to many and referential integrity on. That way if a change is made to an acct, it goes all across the set.

              My acct field is set to auto increment and I have never had a problem with it.

              I do use a lookup on my child records with an imbedded browse. That was a bear for me to get only the records to show that I wanted, but it works very well.

              No xbasic was used for this.

              Dave Mason
              www.lotrun.com
              Dave Mason
              [email protected]
              Skype is dave.mason46

              Comment


                #8
                Re: Simple set problems

                Thanks to everyone for their help. Guess I should have explained what is going on a bit more than I did.

                This is something called USB Medic Alert, which you can see at www.USBMedicAlert.com

                It is for those who have severe medical problems and is a modernized version of the MedicAlert bracelets you see. Only the person's records are right there on their wrist, in case of a medical emergency. Kewl, eh?

                The USB wristbands are being made in China and I expect to start selling it in January. It will be either $39.95 or $49.95. If anyone is interested in adding it to your runtime offerings, there will be a 50% commission available. Private email me if you are interested.

                The part I am working on deals with the ton of different blood tests that can get run.

                My head was in orbit visiting the Space Station when I set up that link with the meaningless date. I have since changed it to a number field, and ALL records contain the number 1. (Took hours to decide on just what number I should use...)

                I recreated the set and am working on the revised form, based on that set. The last record of each test will be shown on one line in an array. See the attached image for the initial test of the set.

                I have data in the Primary and Child tables, all w. the linked field containing a numeric 1.

                Should work.

                My problem now, however, is that the darned form locks up Alpha when I try to view it!

                Can you not use a numeric link in a set? I'm confused, as usual.
                Richard

                Comment


                  #9
                  Re: Simple set problems

                  Richard,
                  My app records the results of numerous blood tests for an individual. Each type of test has its own table that consists of 3 fields:
                  How many tables does that end up being?

                  Mike W
                  Mike W
                  __________________________
                  "I rebel in at least small things to express to the world that I have not completely surrendered"

                  Comment


                    #10
                    Re: Simple set problems

                    Richard,

                    How is the view from up there. :D

                    Are the new set links 1:1 or 1:many? I have had problems in the past showing child data from a 1:many set by directly placing the fields on a form when no browse was present.

                    IOW having a form based on a 1:many set with an embeded browse using only some of the fields, say a product description for invoice line items, and then all the detail fields placed directly on the form works fine. But if you don't use a browse because you want to just see the first or last or some other one record then strange things happen. Some times it will display a record and others not.

                    If you just want to view one particular record not in a browse go with the 1:1 link. Set definitions take up very little space so if you need to view 1:many for some other purpose make a second set. The kilobytes I have found are in the form definitions so having two forms in one set or one form each in two sets doesn't make much difference.
                    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


                      #11
                      Re: Simple set problems

                      Richard:
                      STOP!
                      The answer to your question is very simple, but I am afraid you might have made a mess of things!
                      My head was in orbit visiting the Space Station when I set up that link with the meaningless date.
                      First you ventured in the outer space and now, I think, you reached the deep end! a black hole!

                      My problem now, however, is that the darned form locks up Alpha when I try to view it!
                      When you used 1 as a link (nothing wrong with that by the way) and you made every link = 1, now every parent record, pulls every child record from every child table, it's a mess!

                      Before you make matters worse, do you have a back up?

                      Comment


                        #12
                        Re: Simple set problems

                        Gabe,

                        I am 99.9% sure Richard will only ever have one parent record. I am sure if he had a second parent record he could use .... wait for it ..... 2 :)
                        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


                          #13
                          Re: Simple set problems

                          Tim:
                          Why do you assume that?

                          Comment


                            #14
                            Re: Simple set problems

                            Originally posted by G Gabriel View Post
                            Tim:
                            Why do you assume that?
                            In a previous thread I wrote
                            Originally posted by Tim Kiebert View Post

                            Pre-empting any answers you may provide I would...
                            1. Add a person_Id field (to the individual and test tables) and use that as the link to your sets (as Mike suggested) (This would also allow you to use the app for multiple individuals in case a parent wanted to record children info to carry with them.)
                            and later Richard responded

                            Originally posted by rfha View Post
                            Thanks to everyone for their help. Guess I should have explained what is going on a bit more than I did.

                            This is something called USB Medic Alert, which you can see at www.USBMedicAlert.com

                            It is for those who have severe medical problems and is a modernized version of the MedicAlert bracelets you see. Only the person's records are right there on their wrist, in case of a medical emergency. Kewl, eh?

                            The USB wristbands are being made in China and I expect to start selling it in January. It will be either $39.95 or $49.95. If anyone is interested in adding it to your runtime offerings, there will be a 50% commission available. Private email me if you are interested.
                            and I have seen a bit of his app that he has posted in a thread some time ago.
                            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


                              #15
                              Re: Simple set problems

                              Tim:
                              Hope you are right, this does not sound like it though!
                              I have since changed it to a number field, and ALL records contain the number 1.

                              Comment

                              Working...
                              X