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

Wait dialog for Script to execute series of oiperations

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

    Wait dialog for Script to execute series of oiperations

    I created a series of operations, delete, append, post, delete, and i created a script and put all the operations on to it, then i created a dialog box to play the script if the user selects yes, How will I determine if all the operations are executed and at the same time display a message for the user to wait until the process is complete?

    #2
    Re: Wait dialog for Script to execute series of oiperations

    In a script, an operation does NOT wait for the one before it to end before it starts. It is concievable for a bunch of operations to run at once. It may be better if EACH operation in in a use defined function that is called from that script. That way the script waits for the function to complete before stepping to the next one. Setting a wait time can work, but as tables get larger, timing may also need to be longer.
    look at the ui_dialog boxes you can use for the warnings to users? You can also use one to tell the user that it is all done.
    Last edited by DaveM; 03-09-2012, 08:49 PM.
    Dave Mason
    [email protected]
    Skype is dave.mason46

    Comment


      #3
      Re: Wait dialog for Script to execute series of oiperations

      Thanks Dave, You mean, I will just put four operations in a script and i put a close dialog at the end? don't know much about alpha but this is what my conclusion is. From what i mentioned, all four operations will execute depending on the volume of data processed, and that is the time the close dialog will also execute? please correct me if I'm wrong.

      Comment


        #4
        Re: Wait dialog for Script to execute series of oiperations

        I will just put four operations in a script and i put a close dialog at the end?
        NO, not what I said
        Put each operation in it's own udf and then call each udf from the script (or another udf) in whichever order you need. Make 4 different udf's and one script or another udf.
        Dave Mason
        [email protected]
        Skype is dave.mason46

        Comment


          #5
          Re: Wait dialog for Script to execute series of oiperations

          On this subject Dave would you think there is need for concern with code of this nature in one script?
          A copy operation
          Code:
          tP1 = table.open("stmas")			
          copy.db = a5.Get_Path()+"\\"+sumfile 
          copy.set = ""
          copy.dd = .F.
          .....etc. down to....
          tP1.copy()
          tP1.close()	
          file_add_to_db(copy.db)
          ...followed by code that operates on that new table and code to post() may not wait for the copy() operation to complete?...
          Code:
          table.add_fields(sumfile, fields)
          ...followed by
          Code:
          tbl.post()
          Last edited by Ray in Capetown; 03-10-2012, 03:01 AM.

          Comment


            #6
            Re: Wait dialog for Script to execute series of oiperations

            Hi Ray,

            Originally posted by Ray in Capetown View Post
            On this subject Dave would you think there is need for concern with code of this nature in one script?
            Dave is not correct in what he has stated, although is trying to stop a problem using a mechanism of functions.

            Alpha runs in a thread (read it also as a session) environment. Every form and browse, operate in their own thread/session. That means they operate independently, and code on one can be running while code on the other is running. This typically doesn't happen because most code is human driven events, like a button push on 1 form. Most humans don't press a button on another form until the 1st is complete, but they could.

            If the code takes much longer than a person to go to another session (form/browse/etc) and press a button there, then the new button's event code will be running at the same time as the 1st button's code is running. This is not a problem, unless one button depends on the result of the other.

            One solution is to set a variable (say global to make it easy) that one button set's when it starts, and it sits in a loop waiting for the other button from another session to clear it before continuing.

            Now one aspect of a UDF is that it's code must complete before continuing the code it was invoked from (that thread/session). However, that code could effectively open up an independent thread/session (e.g. form), and the function could still finish with that new thread/session still open. If that is the case, it serves no purpose (for this reason anyway) to encapsulate the code in a UDF.

            Now some printing functions for mailing labels, reports and letters still open those layouts in their own thread/session, but will have a mechanism to not continue before they are closed (modal or session modal). Other printing functions are modeless, meaning they run the session totally independently.

            Which brings us back to Alpha operations (ones on the Operations code tab). Depending upon which operations you are doing, it may create a thread/session but may or may not continue the code in the session that invoked it, depending upon settings or functions used to invoke it, or used in it's embedded XBasic code.

            As for the next question, as to which functions for those operations run modal, or session modal or modeless, I don't know, nor do I have a list. But I would say that most tend to work sequentially if embedded in the same code for an event.

            So why do UDFs fix small timing problems? This has to do with
            1. Code that may run portions of what they do in other threads (generally compiled C code type functions ) that must complete before that function can exit

            2. UI (User interface) thread which operates in the foreground. It is responsible for refreshing the display and processing modal and modeless XDialogs events and probably some other stuff too (all in basically 1 thread). This is why you will often see Alpha's display go all white, or seem to hang, even though it is not hung. It is just waiting for some code that is running in this thread to complete before it can refresh the screen. UI_YIELD(), AND Xbasic_Wait_for_idle() are 2 functions that effectively communicate to this foreground thread. The information in this paragraph is not exact or precise, but is what I have derived from years of Alpha Five debug, testing and experience. Take it only as useful info to help you with your code. It could also potentially change (or portions of it) in a future version of Alpha but is how I see it through version 11.
            Last edited by csda1; 03-10-2012, 11:15 AM.
            Regards,

            Ira J. Perlow
            Computer Systems Design


            CSDA A5 Products
            New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
            CSDA Barcode Functions

            CSDA Code Utility
            CSDA Screen Capture


            Comment


              #7
              Re: Wait dialog for Script to execute series of oiperations

              Thanks for all that Ira

              Comment


                #8
                Re: Wait dialog for Script to execute series of oiperations

                Ira,

                With all due respect, I disagree! Nothing to do with Ray's question. He came in after the original question.

                The original question was one script and multiple operations. There was no explanation as to what table(s) they were acting on. This can and usually does become a problem. It may not show with a small number of records, but as the records go up, so does the problem of timing.

                Alpha does not wait in a script, it goes straight down the line and keeps going until it gets to the end. The only ways to stop that are a wait or function call. If using a wait call, then how long?

                I have been there and had it happen! I would never put 5 operations of any kind in one script unless they had absolutely nothing to do with each other.
                Dave Mason
                [email protected]
                Skype is dave.mason46

                Comment


                  #9
                  Re: Wait dialog for Script to execute series of oiperations

                  Hi Dave,

                  If there is one person on this board who supports the use of functions, it is me. But whether the code is in a function or not, does not change the order of processing in any code. However, it does isolate the local variable spaces, which is a very good thing. You could just as easily call some code with a script_play() versus calling it as a function if encapsulated as a function. It will make no difference.

                  Originally posted by DaveM View Post
                  The original question was one script and multiple operations. There was no explanation as to what table(s) they were acting on. This can and usually does become a problem. It may not show with a small number of records, but as the records go up, so does the problem of timing.
                  It does not matter what tables they are operating on (but probably worse if competing for the same resource, in this case a table). The longer the processing is going on (e.g. processing more records), the more likely two threads may fight with each other, but their code is still operating in a synchronous manner.

                  But if you do use a function, it is definitely not going to make timing any worse, EVER!

                  Originally posted by DaveM View Post
                  Alpha does not wait in a script, it goes straight down the line and keeps going until it gets to the end. The only ways to stop that are a wait or function call. If using a wait call, then how long?

                  I have been there and had it happen! I would never put 5 operations of any kind in one script unless they had absolutely nothing to do with each other.
                  As I stated, many operations MAY run portions in other threads, whether specified or not.

                  I would be happy to look at any simple example you can provide where a database would make a difference whether in a function or not in a function (other than by extra delay from function overhead, which is the equivalent of a delay). and explain any difference precisely in terms of what I stated above.
                  Regards,

                  Ira J. Perlow
                  Computer Systems Design


                  CSDA A5 Products
                  New - Free CSDA DiagInfo - v1.39, 30 Apr 2013
                  CSDA Barcode Functions

                  CSDA Code Utility
                  CSDA Screen Capture


                  Comment


                    #10
                    Re: Wait dialog for Script to execute series of oiperations

                    To do that, we would have to have Jetson put the whole code of his script up for display. I never kept such stuff after conversion to udf.

                    If you are copying records to a table and deleting records from the table being copied from and appending other records and at the same time merging two tables including one of the aforementioned, you will have a problem somewhere down the line with an unbroken script. Some records my disappear/duplicate/???
                    Dave Mason
                    [email protected]
                    Skype is dave.mason46

                    Comment


                      #11
                      Re: Wait dialog for Script to execute series of operations

                      Being new to alpha five, i came up with this process to update a delivery table, first by creating a temporary table since it is automatically saved in alpha browse control, then
                      on the button called post delivery, i created a series of operation shown on the attachment, the idea is, i created a post op to update the inventory on the items table, then append delivery header temp to delivery header final table , and append delivery detail table to delivery detail final, and third op is deleted dlvry header temp table and fourth op is to delete dlvry detail temp table,then displayed the ok button then finally close the form, , after the operation is saved, the onsave event is called to update an item transition table to track the flow /history of every item.I have no idea if it is the right thing to do in alpha , i did try on a 3 record and it was successful, but based on best practices i dont know if this is the right thing to do, what i want is to have the script to finish every operation before it continues to the second operation but i have no idea on how to accomplish this in alpha, In previous experience in VB6, it is something called a TRANSACTION, first process will be executed but if there will be problems in the succeeding ops the changes made will be rolled back to its original state, can this be done in alpha? I'm sure there is a way, please advice, thanks!
                      Attached Files

                      Comment


                        #12
                        Re: Wait dialog for Script to execute series of oiperations

                        Is the image above acceptable in posting, appending and deleting records? First, a post operation is executed, 2nd, 2 tables are appended to each identical tables, then after appending, the two original tables were deleted.Is this acceptable in alpha, will the append operation execute and finish first before the delete operations are executed?

                        Comment


                          #13
                          Re: Wait dialog for Script to execute series of oiperations

                          Use action scripting to help build the script. Then copy to xbasic to a script that will actually be executed.

                          Or as Ira preaches and we all agree build functions...
                          Al Buchholz
                          Bookwood Systems, LTD
                          Weekly QReportBuilder Webinars Thursday 1 pm CST

                          Occam's Razor - KISS
                          Normalize till it hurts - De-normalize till it works.
                          Advice offered and questions asked in the spirit of learning how to fish is better than someone giving you a fish.
                          When we triage a problem it is much easier to read sample systems than to read a mind.
                          "Make it as simple as possible, but not simpler."
                          Albert Einstein

                          http://www.iadn.com/images/media/iadn_member.png

                          Comment


                            #14
                            Re: Wait dialog for Script to execute series of oiperations

                            tHank you Al, it really had problems when there are many records to append and after that delete the records after appending, i tried to create an inline xbasic then copied the code to a function individually with post, append and delete of the same tables, Problems is that not all records were appended because i think the delete function was executed while the append operation is in progress. that's how I understood based on the suggestion of all here in this thread,did i follow it right?
                            Last edited by JetLi; 03-25-2012, 08:22 PM.

                            Comment

                            Working...
                            X