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

Running Operations From Xbasic

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

  • Running Operations From Xbasic

    I've run into a bizarre problem which makes me wonder if Alpha is behaving as desired. Namely, I have several operations which are run from Xbasic scripts. Since the operations require you to specify the master and transaction tables I would have thought that they were completely independent of which form contained the script from which they were called. Instead, I have found out the *&^%$#*! way that they are dependent on the table.current().

    Specifically, a form based on Table_A has a button with a script which calls the Append_1 operation. In the Append_1 operation, the master table is Table_B and the transaction table is Table_C. When this script runs, Append_1 completes its task and the usual message box appears stating the number of appended records. Upon pressing OK, however, the script has an error reading: "Object does not support requested interface."

    Upon viewing the Xbasic code for the Append_1 operation, I later realized that the operation opens the "current" table onto which it later applies the append method:

    a_tbl = table.current()
    . . .
    . . .
    a_tbl.append()

    This implies that the behavior of an operation is dependent on what tables are open at the time the operation is called. Hence, if two forms are based on different tables, you cannot call the same operation from each form and expect the same results. Have others encountered this problem?

    Workarounds (e.g. opening files prior to calling the operation) are obvious but I wouldn't have expected such to be required. Thank you.

    Steve



  • #2
    RE: Running Operations From Xbasic

    Steve,

    Is it possible that the operation requires exclusive access to one or more tables and may not be able to get it depending on the form from which it is launched? I suspect this is the case but I am not certain.

    If this is the issue, the solution is to rewrite the actions on a record-by-record basis rather than using high-level code.

    I am doing exactly this in order to eliminate some problems with simultaneous appends to a common destination.

    Bill
    Bill Hanigsberg

    Comment


    • #3
      RE: Running Operations From Xbasic

      Hi Bill,

      Whatever the requirements may be I personally think that the Action Scripting (and Xbasic Script Genie) should only let you select operations assigned to table.current(). There is no indication of these restrictions when running a saved operation.

      I see your point in doing a record-by-record loop rather than relying upon operations. But for now I am going to do a compomise. Namely, whenever the table for an operation is not table.current() I am going to replace the [operation].run() statement with its Xbasic equivalent (obtained from the operation editor). Then I will replace the table.current() assignment with a table.open() and close it when finished.

      I still have no explanation as to why Alpha doesn't simply open the master table. If they want to avoid too many open/close sequences, they could at least have a flag to tell the operation whether to use current() or do an open/close. Maybe Lenny is reading this thread.

      Steve

      Comment


      • #4
        RE: Running Operations From Xbasic

        Bill,

        I just stumbled onto another alternative which looks cleaner. When you edit an operation and view the Xbasic code (from the toolbar), a window pops up with the code. At the top of the window is a list of three options:
        1. Raw
        2. Processed
        3. Processed - without confirmation dialogs

        While Raw is the default, the Processed options do indeed open the master table rather than use the table.current(). One button on this window allows you to save the code as a script.

        Well, seeing no way to set this option on the operation itself, I plan to save scripts for any operations where this poses a problem. Then with a script_play_local(), I can actually be running the operation. Using a naming convention, I will make it obvious that this script is derived from an operation.

        Thanks for your thoughts on the matter.

        Steve

        Comment


        • #5
          RE: Running Operations From Xbasic

          Hi Steve,

          This is interesting and I hope I come to understand this area better.

          You write, "While Raw is the default, the Processed options do indeed open the master table rather than use the table.current()."

          I see how this would help with some problems but if an operation requires exclusive use of a table opening a second instance will not work, right?

          The question is, does an append require exclusive access?

          I think it may. I had problems on a network with one until I wrote around it as I described.

          Bill
          Bill Hanigsberg

          Comment


          • #6
            RE: Running Operations From Xbasic

            Hi Bill,

            As you indicate, I may check the table out insofar as in_use, multiple-instances and exclusive use conditions prior to calling the operation. In the meantime, I've learned a few more things but it still doesn't seem to jive.

            In Ed's good ole CHM, there is a page titled "Using the Xbasic Window" which gets into those three modes for an operation. Under "Processed Xbasic", it states that when you switch to this mode "... the code shown changes to the actual complete script that will be processed by Alpha Five." Moreover, for a given operation on the ControlPanel, if you select "Run Genie"-""Show Xbasic"-""Low Level Xbasic" it does show the "Processed" Xbasic which opens the master table - doesn't use the current() table.

            HOWEVER, it stalls upon using the statements:
            query.filter = ""
            append.run_silent("aTL_Punch_Records",query.filter)
            whereas it runs fine if I replace the above statements with the "Processed" Xbasic code generated by the append operation editor.

            Thus, it is still a mystery as to why the run_silent() and run() methods get hung up. Thanks again for your input.

            Steve

            Comment


            • #7
              RE: Running Operations From Xbasic

              Hi again,

              "In Ed's good ole CHM, there is a page titled "Using the Xbasic Window" which gets into those three modes for an operation. "

              Valuable; I'll check this out immediately. Thanks.

              "Moreover, for a given operation on the ControlPanel, if you select "Run Genie"-""Show Xbasic"-""Low Level Xbasic" it does show the "Processed" Xbasic which opens the master table - doesn't use the current() table."

              I guess because there is no current table when the context is the control panel, no?


              "HOWEVER, it stalls upon using the statements:
              query.filter = ""
              append.run_silent("aTL_Punch_Records",query.filter)
              whereas it runs fine if I replace the above statements with the "Processed" Xbasic code generated by the append operation editor. "

              There must be something else besides (before) these lines causing the trouble. These seem totally inoccuous.

              I am working on fixing something which taps into this exact issue so I may get back to you. If my "fix" doesn't work it will disconfirm my understanding and if does work I will be free to move on to new errors!

              I think of this as a spur to personal growth as it fosters humility.

              Best,
              Bill
              Bill Hanigsberg

              Comment


              • #8
                RE: Running Operations From Xbasic

                Hi Bill,

                First for the good news. While the CHM indicates that the last parameter for append.run() is [Silent as L], there is actually another parameter showing from the bubble help. That parameter is [Show_Xbasic as L]. When I use the lines:

                query.filter = ""
                append.run("aTL_Punch_Records",query.filter,.T.,.T.)

                it works without hanging up!

                I'm not sure what the Show_Xbasic is supposed to do but I've notified Ed about the discrepency. Whatever it's intention, it seems to get me by. I guess I'd label this a "black hole solution".

                Steve

                Comment


                • #9
                  RE: Running Operations From Xbasic

                  Hi Bill,

                  Well, so much for that "black hole solution". The reason that it didn't hang up is because it didn't process! Maybe that Show_Xbasic parameter is for something like posting the Xbasic lines (somewhere like the trace window) without executing them. I still don't know what it does.

                  So the lesson learned is whenever a statement causes the system to hang, just comment it out and it won't hang anymore. The safest system is a null system.

                  Steve

                  Comment

                  Working...
                  X