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

while .not. tbl.fetch_eof() not working

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

    #16
    Re: while .not. tbl.fetch_eof() not working

    OK.. I see a question coming, or should be coming:
    Why open a second instance of the table? Is that a good idea?

    No. It is not.

    To avoid opening a second instance of the table, i.e. using table.open() which is a lousy last ditch resort idea, instead of pointing to the table, point to the browse on the form and do your changes there.

    That sounds logical, doesn't it?

    It does, but in real life, I found although further tests are warranted, that pointing to the table works much faster than pointing and doing changes in the browse. Hopefully I am not confusing anyone, what I am trying to say is:

    Even though table.open() might sound like a lousy idea, it works much faster than the other logical alternative (the browse) which makes it the more logical illogical choice.
    Last edited by G Gabriel; 07-09-2008, 09:09 PM.

    Comment


      #17
      Re: while .not. tbl.fetch_eof() not working

      I have a theory to this logical illogical business:

      If you choose to point to the browse and make your changes stepping down the rows of the browse, each and every time you go from one row (record) to the next, alpha synchs the form (all of it, the whole nine yards of it) each time you do that making it much more slower than if you point to the table, make your changes and synch the form only once. Now this illogical stuff might make some sense.

      If it is the case, then alpha need to do something akin to AJAX.
      No, refresh() won't work in a scenario like this.

      Comment


        #18
        Re: while .not. tbl.fetch_eof() not working

        Although it's strictly a matter of opinion, in this case I'd have to say that using table.open() isn't necessarily wrong as long as the developer understands the implications.

        The good thing is that it should be much faster than making the changes at the form level.

        The bad thing is that resynching the current form will be more problematic.

        And, now that I've thought about it a bit more....

        I haven't tested the database that was uploaded but there is another possibility IF the real problem is just that it's looping through a lot of extra records because of the child tables. Read the Help file on .fetch_next(): (bold added)
        Found_Flag as N = <TBL>.FETCH_NEXT( [ Outline_Level_Number as N ] )
        Outline_Level_Number:
        Optional. Used when fetching through the records of a set. The outline level determines the depth of the fetch, so that tables at lower levels in the set can be excluded from the Fetch operation.

        Given the problems of using table.get() and the speed issues with using form methods, I think I'd chose to use table.open() if (1) setting the outline level won't solve the problem and (2) there were a lot of records involved. If it was only a few records, I'd consider form methods.

        The other alternative I'd consider is, "Is there another way to do this that would be easier and might even be more logical for the user?" For example, maybe this could be done from a button on the maintenance menu. That way table.open() could be used and there would be no concern about resynching the form because the form wouldn't have to be open and could be forced closed by the script if necessary.

        Too many people get stuck in a rut and keep trying to do things the hard way because that was the first way they thought of. Learn to change your thinking. When, "Why doesn't this work?" hasn't yielded any results, step back a bit and switch to "What overall end result am I trying to accomplish and is there a totally different way of accomplishing it?" The corollary to this when posting questions on this message board is to (a) tell us what you are doing and what isn't working BUT (b) also tell us why you are doing this so we can offer other alternatives if they might be more appropriate.

        That's a situation I've seen over and over again on this message board. A "simple" question is asked and everybody attacks that one question as if the original poster (OP) was actually doing it the best way possible. (After all, we usually don't have enough info to offer other ideas.) Many times there is a better way once we know what the OP is really trying to accomplish. And that's not always an issue of inexperience; sometimes even those of us who've been doing this for years can get stuck in a rut and need someone else to say, "Hey, there's a better rut over there."

        And, for those who've read this thread but not read the Help files, the .T. in .change_end() is not required - because it's the default. The option to use .T./.F. here is so that you could put in a logical variable and save or not save a record based on some calculation. Personally, I've never understood the value of this - why not just run the calculation first then skip the whole change_begin()/end() section if the record shouldn't be saved? (Maybe this is an Action Scripting issue. I never use A/S anymore so I couldn't say.)

        The only time I've ever used this option for the .change_end() is during development. I've been known to create a logical variable near the top of the script and set it to .F. while testing so that I can run the routine without actually changing the data in the table. This way I can re-run the routine as often as I want for testing purposes without having to restore the original data every time I run it. Once everything seems to be working, I just change the variable value to .T. and run the script "live".

        Note: The T/F in .change_begin() is a different story - see the Help file.

        Comment


          #19
          Re: while .not. tbl.fetch_eof() not working

          Tom a Gabriel,
          Thanks again for the information.

          Tom, I am not surprised that I am doing things differently then you would (and probably far from the best way). I had not done any sort of programming until I started my adventures here with alpha five a few years ago.

          For the most part, I truly have no idea what I am doing!!! I know what I want for an outcome and do my best to make it happen. Often times, the help files provide 100 ways to do 1 thing and I do not know enough (yet) to make logical decisions. Good old trial and error!

          Although its not expected, your feedback and guidance is truly appreciated. Simply being pointed in the right direction can save me hours of blindly stumbling around the help files and forum...and loads of frustration. I have experienced this time and again!!!

          That being said...this form is intended to allow the user to filter down the list of workouts contained in the wrkout_set.set. Once they have filtered down and checked off the workouts they want, they can assign those workouts to a selected list of clients that were actually chosen in a previous step.

          When the form was built on just the workout table, everything worked great. I could filter the list by selecting criteria on the form, hit the "check all" button, and it would check off the workouts displayed in the browse that met my filter criteria.

          However, I wanted to be able to give the user more information about each workout, so I decided to build the form off of the wrkout_set.set that you see so i could include the exercise information for each workout.

          I have a reason for the strange child table set up. The form used to create the workouts has an embedded browse across the bottom that displays all of the weight and rep information for all of the exercises assigned to the workout. I put this there so the user could see a global picture of the workout as they are designing it.

          However, alpha kept moving the currently selected exercise record to the top of the browse, thus hiding the exercises before it. Since this browse is for feedback and not for entering information, a forum member suggested that I add a second instance of the child table and use if for the embedded browse so the browse would not fetch around l selected records.

          That has worked well, but I keep finding little issues with it here and there. I am very open to suggestions on alternative ways to accomplish the same outcome.

          As for the image fields. I simply do not like using the jpeg image field and would MUCH prefer to use the linked image field. However, part of my application...if I actually ever get it to a point where you could call it that...would be 1500+ illustrations of exercises.

          I have 2 concerns. 1. If i store the images in the DB, and all of the copies of the images that are contained in the workout and the clients workouts, the db is going to become way to large.

          However, I want to offer a demo of the software and do not want people to be able to simply install the demo and have life long access to the illustrations. All they would need to do is know enough to find the installation of the app and they could freely use the images once the demo expired. So I am in a bit of a bind as to how to best approach the utilization of the images.

          Sorry for such a lengthy post...but I thought it might help you to understand why I have done some of the things I have done.
          Thanks again.
          Tony

          Comment


            #20
            Re: while .not. tbl.fetch_eof() not working

            I have a feeling I was speaking Herogliphics, so let's make it simple:

            Here is what the script should say:
            Code:
            dim tbl as p
            tbl = table.get("workouts") 
            tbl.fetch_first()
            while .not. tbl.fetch_eof()
            	 tbl.change_begin()
            	 tbl.ASSIGN_WORKOUT=.t.
            	 tbl.change_end()	 
            	 tbl.fetch_next(1)
            end while
            Or:

            Code:
            dim tbl as p
            tbl = table.current(1) 
            tbl.fetch_first()
            while .not. tbl.fetch_eof()
            	 tbl.change_begin()
            	 tbl.ASSIGN_WORKOUT=.t.
            	 tbl.change_end()	 
            	 tbl.fetch_next(1)
            end while
            Or:

            Code:
            dim tbl as p
            tbl = table.open("workouts")
            tbl.fetch_first()
            while .not. tbl.fetch_eof()
            	 tbl.change_begin()
            	 tbl.ASSIGN_WORKOUT=.t.
            	 tbl.change_end()	 
            	 tbl.fetch_next()
            end while
            tbl.close()
            Or:
            Point to the browse, which I would rather not do.

            I ran all the above scripts. You could see the speed in the msge box (although not very accurate). Judge for yourself

            .
            Last edited by G Gabriel; 07-09-2008, 11:14 PM.

            Comment


              #21
              Re: while .not. tbl.fetch_eof() not working

              Cal,
              Once again...if I could only have a 10th of your knowledge!!!

              I posted much of the information you suggested while you were writing the post suggesting it. Hopefully it will help!

              I would not call my current position being stuck in a rut. It seems awful cannon-esk from down here.

              The problem I have found is that the immense volume of information included in the help files and on the forum can become very overwhelming. There is so much information I have had troubles finding specific information� if that makes sense. I have also found that there seems to be multiple �methods of doing task X� listed without any real rationale behind why you would or would not a use specific one. And many times, I simply do not know what I am looking for.

              Cannon�not rut. Lets just hope it doesn�t rain.

              Comment


                #22
                Re: while .not. tbl.fetch_eof() not working

                Tony:
                Actually, I found your form very elegant for someone who claims not to be a programmer.

                But Cal definitely has a very good point and I don't think he was hurling insults at you. I brought this point up myself many tmes before but not quite as elequantly. I always siad people set out to leave from New York to Chicago, get lost end up in Atlanta then post a question on the board:
                How do I get from Atlanta to Chicago? when the question should have been:
                How do I get from New York to Chicago.

                Comment


                  #23
                  Re: while .not. tbl.fetch_eof() not working

                  Gabriel...I owe you a post workout beer! Actually, I think I owe several people on this forum.

                  Adding the 1 to the fetch.next() function did it!

                  Thanks for that and I will chalk up another lesson learned.

                  As I mentioned in other posts...I am new to all of this and learning here...so I am not always heading in the right direction. The guidance is very much appreciated.
                  Tony

                  Comment


                    #24
                    Re: while .not. tbl.fetch_eof() not working

                    When looking at your zip file, instinctively I went to table.open() and disregarded all other possible alternative scripts. I am addicted to table.open(). Maybe it's just gut feeling, but it seems to always work best and fastest and I like to stick with a winner.

                    Presenting the other alternative scripts and judging by the speed, you could see why I am a diehard table opener.
                    Last edited by G Gabriel; 07-09-2008, 11:27 PM.

                    Comment


                      #25
                      Re: while .not. tbl.fetch_eof() not working

                      Cals information is always great!!! I have never felt even remotely insulted by him or anybody else on this board. Honestly, quite the opposite! I would have called it quits a long time ago if it were not for people you, Cal, Mike, and so on.

                      I agree with you whole heartedly and make the same analogy when I speak about workout planning for athletes. Getting pointed in the right direction at the beginning is so important.

                      However, I do enjoy the problem solving...regardless of how bad I am at it...that goes along designing this application. Unfortunatly, that gets me a bit lost at times.

                      Comment


                        #26
                        Re: while .not. tbl.fetch_eof() not working

                        Originally posted by CALocklin View Post
                        Although it's strictly a matter of opinion, in this case I'd have to say that using table.open() isn't necessarily wrong as long as the developer understands the implications.
                        Cal - What are the implications? I have started to use xbasic to accomplish some tasks and have used table.open() in a number of scripts where the form is not bound to that particular table. I am very interested in what the pitfalls might be in using this method. It might save me some future headaches and head scratching.

                        Regards

                        Geoff

                        Comment


                          #27
                          Re: while .not. tbl.fetch_eof() not working

                          G, thanks for remining us (read me) about the optional argument that the tbl.fetch_next() method will take. I've never needed to use it and had forgotten about it.

                          Stan has privately called to my attention another unusual aspect about Tony's original set. I don't know if it contributes to the problem here or not, but Tony's three table set is actually based on only two tables. How? Well, he's linked the child table twice using an alias. If I had noticed this first time I would not have bothered to drop the third table mentioned by me in the earlier post.

                          Comment


                            #28
                            Re: while .not. tbl.fetch_eof() not working

                            Originally posted by Tom Cone Jr View Post
                            G, thanks for remining us (read me) about the optional argument that the tbl.fetch_next() method will take. I've never needed to use it and had forgotten about it.

                            Stan has privately called to my attention another unusual aspect about Tony's original set. I don't know if it contributes to the problem here or not, but Tony's three table set is actually based on only two tables. How? Well, he's linked the child table twice using an alias. If I had noticed this first time I would not have bothered to drop the third table mentioned by me in the earlier post.
                            Although I am not a fan of aliases, I don't see that it contibuted anythng to the problem here.

                            I hope the main point I was trying to make, and which I made a little rain dance around since it seems counter-intutive, is not lost. The point is: eventhough from everything you read and came to believe that you are better off, since the table is already open, you are better off to use table.current() and/or table.get(), I, at the risk of sounding off as a contrarian, believe for pragmatic reasons as shown in this example that you are better off with table.open() anytime all the time. Table.open() takes a direct hit at the table, very clean, reliable and fast, couterintutive as this might sound.

                            Maybe one day I will come to regret having made such a bold statment, but that day hasn't come yet.
                            Last edited by G Gabriel; 07-10-2008, 07:45 AM.

                            Comment


                              #29
                              Re: while .not. tbl.fetch_eof() not working

                              G,
                              How can I carry the filter set up by the user (on the form), to the new instance of the table when i use table.open()?
                              Tony

                              Comment


                                #30
                                Re: while .not. tbl.fetch_eof() not working

                                Stan, Tom, Gabriel,
                                Do I need to remove the second instance of the child table from this set?

                                I have a reason for the strange child table set up. The form used to create the workouts has an embedded browse across the bottom that displays all of the weight and rep information for all of the exercises assigned to the workout. I put this there so the user could see a global "picture" of the workout as they are designing it.

                                However, alpha kept moving the currently selected exercise record to the top of the browse, thus hiding the exercises before it. Since this browse is for feedback and not for entering information, a forum member suggested that I add a second instance of the child table and use if for the embedded browse so the browse would not fetch around l selected records.


                                So far this is the only solution that has been suggested. I am very open to ideas.
                                Thanks
                                Tony

                                Comment

                                Working...
                                X