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

Xbasic Loop Processing Examples

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

    Xbasic Loop Processing Examples

    Three examples illustrating ways to loop through a group of related records using Xbasic.

    Example 1 - using a set based form, loop through the child table records linked to the current parent table record.

    Example 2 - Without using a set based form, run a query against a table and then loop through the records in the query list.

    Example 3 - Without using a set based form, and without running a query, set the records in a specific sort order, find the first record that matches a specific search key, and then continue fetching through the table until the search key no longer matches.

    -- tom cone jr

    #2
    Hi Tom. Nice examples. Any chance of posting them as a plain text file too? I just love looking at well written Xbasic code. :)

    Comment


      #3
      Re: Xbasic Loop Processing Examples

      Tom

      I am just now seeing your code on looping xbasic. I will see if this applies to my need (very tricky query involving a separate table)
      Logical Design
      Keven Thibeault
      Boston, Massachusetts
      Dwell in possibility

      Comment


        #4
        Re: Xbasic Loop Processing Examples

        Tom

        I was not able to get the result I was after I tried your code

        http://msgboard.alphasoftware.com/al...ad.php?t=69365

        is the link to my bigger problem, if you have any ideas that would be fab!
        Logical Design
        Keven Thibeault
        Boston, Massachusetts
        Dwell in possibility

        Comment


          #5
          Re: Xbasic Loop Processing Examples

          I can think of a number of ways in which this would benefit my application but have a question,

          currently i have in amy application a form with an embedded browse and a filter to list all records which meet a certain criteria.

          so the user must open a form to obtain the data. from what i understand this function does the same as it will inform the user of the number of records which meet a set criteria.

          so... am i best using my current way or would it make for better programming and better database design to use such a function which loops through the records.

          once the records have been written to the trace window, how would i then use this data if i wanted to perform another action?

          thanks

          richard

          Comment


            #6
            Re: Xbasic Loop Processing Examples

            Richard,
            A new thread may be better but I guess explaining the use of Tom's code is good too....I just don't want to muddy the thread is all.

            Regarding the Trace write-in data. You don't use that data persay (although I guess you could)....it just illustrates that the data can be extracted from the child table.

            Instead of writing to the Trace window you would say after finding a record in the loop, either process it (change values), mark them with either the Alpha "Mark" method or changing the value of a checkbox field, delete them, or any number of things. I use a very similar method to find records that have a checkbox True value, copy the values of each record into another table with the Parent link field that is to be used for a another process later on in my application...all done with a child loop such as this.

            Hope this helps in understanding a bit.


            LATER: I also wanted to add that to see the results in the trace window for the 2 scripts in the example you have to comment out the last trace.clear().
            Last edited by MikeC; 03-29-2008, 12:03 PM.
            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: Xbasic Loop Processing Examples

              Cheers Mike,

              thanks, that does help. i suppose this wouldnt be used for the purpose of my current filterd form, but will definitly come in handy for some other ideas i have, in particular one was to mark several records which have a certain field which is blank and then update that field with the same data.

              currently we have select a record in a browse, open a companion form, enter the data then close the form then do the same for the next record. very time consuming...

              thanks

              richard

              Comment


                #8
                Re: Xbasic Loop Processing Examples

                Tom,

                Can you help me with some code?

                I have a password table named "pwtbl" which consists of
                EmpNum Char 2, (Index)
                Emp_name Char 25 and
                Admin_Status Logical 1.

                I would like to bring up a Login dialog box that runs in Autoexec which asks for a user Employee Number. I'd like to use Employee Number as a Lookup to the password database (pwtbl) to obtain the Admin_Status and hold it in a Global Variable.

                On my Main Menu, when an Administration Button is pushed, I'd like to check the status and if it's 't', I'd like tyo open the admininstartion form else I'd like to display a message of "Un-authorized User and have him exit the script when pressing "OK". If the Employee Nymber is not in the password table (pwtbl), I'd like to display the same message as my previous one and also exit the script when pressing "OK". Can you send me the code to accomplish this?? I'm new to this and very confused as the what to code.

                Thanks, Rudy

                Comment


                  #9
                  Re: Xbasic Loop Processing Examples

                  I suppose so, but I'm curious if you've investigated the built in security functions. You can assign users to groups and then have your button script check to see if the user is a member of a group that is permitted to push the button. What version of Alpha Five are you using, and is it desktop or web app? -- tom

                  Comment


                    #10
                    Re: Xbasic Loop Processing Examples

                    Thanks Tom.

                    I'm using v9 Platium Desktop.

                    If using groups is cleaner and easier then the routine that I outlined then maybe that's the way I should go.

                    If we use the group routine, can it be changed by a client in a run-time mode? I thought the routine that I outlined could be. Whatever you think is easier, cleaner, flexible, and can be used by the client once once a run-time version is installed.

                    Sincerely,
                    Rudy

                    Comment


                      #11
                      Re: Xbasic Loop Processing Examples

                      Rudy, if all you need is to know if the user has Admin_Status then the built in security system may be overkill. On the other hand if this is the first step in implementing a system which controls access to various forms and functions depending on what privileges a user has been given, then you would be well advised to spend some time with the built in security sequences before doing all the additional work to roll your own from scratch.

                      Yes, the Administrator can reassign groups and passwords in the runtime environment.

                      By the way, your question should have been posted to the A5v9 Desktop forum. We're in a forum reserved for discussion of the code samples that have been posted here. Your question has nothing to do with the example code posted at the top of this thread.

                      Comment


                        #12
                        Re: Xbasic Loop Processing Examples

                        Tom,

                        I'm not sure as I have never used A5 Desktop, but since it is only for 1-up programming with no ability to be used in a multi-user environment or web environment, are the security methods included?

                        Comment


                          #13
                          Re: Xbasic Loop Processing Examples

                          Doug, I have the full version but only one license. The security system seems to be working fine. If I had different staff members who needed to run an application they could each log on separately, one at a time of course. I think the security model for the web app server is a completely different animal. -- tom

                          Comment


                            #14
                            Re: Xbasic Loop Processing Examples

                            I was meaning that Rudy mentioned he had the DESKTOP version not the Full version as you (and I) both have. The Desktop version is much more limited. I just didn't know if he would be able to use the Security methods or not.

                            Comment


                              #15
                              Re: Xbasic Loop Processing Examples

                              Doug, I missed that. I don't know what features the DESKTOP version has. Had even forgotten that there was a DESKTOP version.

                              Can't find any information on a so called Desktop version in the Alpha Five store or product listing. Might it be known by a different name? Is there a limited version of Alpha Five vers 9 Platinum Edition?

                              Comment

                              Working...
                              X