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

How to modify a function

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

    How to modify a function

    We have amended the source code in existing functions . We save the changes, compile the code and execute a test script. However it is the original code that is executed not the updated code.
    To force the updated code to execute it appears we have to close the database then reopen it.
    Is there a setting/method we need to change that controls this ?
    https://appsbydesign.co.uk/

    #2
    Re: How to modify a function

    Are you compiling into an aex? If so I think you do have to close Alpha and restart for the aex to be opened again, loading the new version of the function.
    There can be only one.

    Comment


      #3
      Re: How to modify a function

      Originally posted by Stan Mathews View Post
      Are you compiling into an aex?
      No. Not compiling to aex. When i mention compiling it is the option from the Code dropdown menu Check syntax.
      https://appsbydesign.co.uk/

      Comment


        #4
        Re: How to modify a function

        Originally posted by mumfie View Post
        Re: How to modify a function
        If you mean a function that you have written previously and used it somewhere, then clearly you should never modify it, start over with a new function.

        On the other hand, if you mean a function that you have just written, you could try the refresh button in the CP.

        Comment


          #5
          Re: How to modify a function

          Originally posted by mumfie View Post
          We have amended the source code in existing functions . We save the changes, compile the code and execute a test script. However it is the original code that is executed not the updated code.
          To force the updated code to execute it appears we have to close the database then reopen it.
          Is there a setting/method we need to change that controls this ?
          If you are talking about a global UDF (User Defined Function) and do a save (which also does a compile), then that code will execute in the next usage with 2 caveats.

          1st, there must be no errors in the new version. Otherwise, you will run the last good compiled version of the code.

          2nd, you must close the debugger if open for the new code to take effect in the debugger.
          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


            #6
            Re: How to modify a function

            Ira,
            1st, there must be no errors in the new version. Otherwise, you will run the last good compiled version of the code.
            Nice to learn of this!!!

            If you are talking about a global UDF (User Defined Function) and do a save (which also does a compile), then that code will execute in the next usage with 2 caveats.
            I have to disagree with this, at least in my limited use of functions. The only way I can get a change to become part of any function that I run, the database itself must be closed and reopened....even say as a test to add a messagebox inside the function---do this and then run the function...the messagebox will not appear. Close the database and reopen, then run the function--the messagebox appears.

            Also, as part of this, I have noticed when I add the 'description: bubblehelp to a function or add more "functionality" to the function such as with the addin.function_argument_help() function, Alpha, itself, has to be completely closed and then reopened before they will work.

            Ira, if I am doing something to cause this headache (or more likely, NOT doing something!), please let me know as it certainly does take a bit of time having to do this closing and reopening when developing a complex function.
            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: How to modify a function

              Hi Mike,

              Originally posted by MikeC View Post
              I have to disagree with this, at least in my limited use of functions. The only way I can get a change to become part of any function that I run, the database itself must be closed and reopened....even say as a test to add a messagebox inside the function---do this and then run the function...the messagebox will not appear. Close the database and reopen, then run the function--the messagebox appears.
              I can't think of a better reason to purchase my CSDA Code Utility, which closes A5, and reopens it with all the same windows restored.

              But honestly, for normal coding, other than that below, there is no reason to have to close and reopen A5, or even just the database. There must be something else happening. So while you may have an issue, it's not normal operation.

              Originally posted by MikeC View Post
              Also, as part of this, I have noticed when I add the 'description: bubblehelp to a function or add more "functionality" to the function such as with the addin.function_argument_help() function, Alpha, itself, has to be completely closed and then reopened before they will work.
              Both of these are initialized at startup, or when 1st used. Thus any changes are ignored until restarting A5. Declarestruct is another thing that requires restarting A5 when you make changes. These are valid reasons to purchase my CSDA Code Utility. In fact, it was developed because of Declarestruct requiring many restarts in my development cycle.

              Originally posted by MikeC View Post
              Ira, if I am doing something to cause this headache (or more likely, NOT doing something!), please let me know as it certainly does take a bit of time having to do this closing and reopening when developing a complex function.
              I have no idea what the issue would be, but I'll suggest that you place the code in the standard ADB file for the database. Don't have the same function in an installed AEX (although the ADB should override the AEX), and make sure you do a Save, not a compile (F4) which does not save the code. Also, can you show me a typical Global UDF that you have problems with?

              If code is on forms in design mode, save the code, then save the form. This solves some problems encountered there.
              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


                #8
                Re: How to modify a function

                Figured it out Ira, all.

                Saving works just as Ira said UNLESS you add functionality to a function with the addin.function_argument_help() function. When this is used ahead of a function then the database has to be closed and then reopened...a good reason to possibly place the addin function to the Addins folder--think I will and then just have it commented out in the function itself...unless I am working on the Addin function itself.....Time for Ira's utility next time I pull this function out I guess!!

                This probably doesn't address Colin's problem though.
                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


                  #9
                  Re: How to modify a function

                  Thanks for the responses although none of the solutions work for us using the latest alpha5 build. I have found if we export the modified function then reimport it does execute the modified version.
                  https://appsbydesign.co.uk/

                  Comment


                    #10
                    Re: How to modify a function

                    Based upon above I created a simple script which appears to resolve the problem. After making the change save it then run the script below.
                    Make sure you have a backup before attempting to test it.

                    'update scripts and udfs
                    export_scripts_and_udfs("c:\myfunctions.txt")
                    import_scripts_udfs("c:\myfunctions.txt",.t.,.t.)
                    https://appsbydesign.co.uk/

                    Comment


                      #11
                      Re: How to modify a function

                      Hi Colin,

                      Originally posted by mumfie View Post
                      Based upon above I created a simple script which appears to resolve the problem. After making the change save it then run the script below.
                      Make sure you have a backup before attempting to test it.

                      'update scripts and udfs
                      export_scripts_and_udfs("c:\myfunctions.txt")
                      import_scripts_udfs("c:\myfunctions.txt",.t.,.t.)
                      While you have a workaround that solves the problem, I'll reiterate that you don't need to do this. There is something else you are probably not doing. You should try to find out what that is.

                      You can probably skip the above export/import if you execute the following line
                      load_external_udfs(file.filename_parse(a5.Get_Name(),"DPN")+".alb","Application")
                      It doesn't solve your problem, but will at least make it less painful.
                      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


                        #12
                        Re: How to modify a function

                        That seems hardly necessary.
                        I suggest you post a sample of your UDF before and after the modification.

                        Comment


                          #13
                          Re: How to modify a function

                          Originally posted by G Gabriel View Post
                          I suggest you post a sample of your UDF before and after the modification.
                          I enclose a simplified example to hopefully demo problem.


                          steps to reproduce

                          run the script ChanRF_DAO_Test
                          view trace window and note text output

                          amend function ChanRF_List_InsertDAO
                          simply amend text being output to trace and save

                          run the script ChanRF_DAO_Test again
                          view trace window and note text output
                          the text displayed is that before the amendment

                          Now close and reopen the database.
                          run the script ChanRF_DAO_Test
                          view trace window and note text output
                          The amended text is displayed
                          https://appsbydesign.co.uk/

                          Comment


                            #14
                            Re: How to modify a function

                            OK Colin.. If I am reading this correctly and without all the fluff:
                            Your 1st function calls the second function
                            And the second function calls the first one!
                            Am I in the ballpark?
                            I am reading this in a bit of a rush, but I think that's it in a nutshell.
                            In addition:
                            Your 1st function uses a logical variable OK. This function calls the second one and the second one has a variable also called OK that outputs the message.
                            Keep in mind that these variables as you have them are LOCAL, i.e. only visible to the function itself and not to any other function.

                            Comment


                              #15
                              Re: How to modify a function

                              Hi Colin,

                              Originally posted by mumfie View Post
                              I enclose a simplified example to hopefully demo problem.
                              Unfortunately, you are connecting to an SQL table that we don't have.

                              Nevertheless, eliminating the parameters of the function, it works just fine after each save. I use pointers all the time in parameters, so it is not the parameters either.

                              I suspect that you have some issue with calling pointers that causes the function never to be executed (or a function error occurs that is trapped)

                              Does that help?
                              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

                              Working...
                              X