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

BUG: Custom toolbar makes error in report save

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

    BUG: Custom toolbar makes error in report save

    Attached is a very pared down application that showes a bug when final compilation for distribution was tested. I would like confirmation on this before submitting it as a formal bug report. It is a bit complicated to reproduce over and over again in the example, because it seems to clear itself, in the full app it persists. Secondly, this app is in v7, because that is what the client owns full runtime of, but when I tested it in v10, the bug is here also.

    The app has a form named "Status Agents". There is a red button on that form that runs a UDF named 'agent_status_send()'. When the form is configured with system toolbar... all is fine. When configured with ANY custom toolbar an error is generated. I believe the error manifest at line 53 of the code where it saves the report as a PDF. To show the error do the following.

    1. from the main menu, open the Status Agent form
    2. press the red 'Preview and Email....' button.
    3. press Exit the Report preview toolbar button to close preview
    4. press'yes' button on the 'Report Email Query' dialog
    ......The email client will open showing the email with attachment to send
    5. press red 'X' to close the dialog (you will be out of app so go back to it).
    6. place form in Design mode. Goto Form Properties.
    7. Select Menu/Toolbar tab
    8. Select "Custom Form" in the Toolbars > View, press "OK", Save the layout.
    9. Return the form to view mode.
    10. Repeat steps 2 and 3 and the error will manifest.
    .... The error in this example manifests once and then clears. In my complete app it persists. You can generate the error over and over again by returning the form toolbar to System toolbar, run the UDF, then return toolbar to Custom and run the UDF.

    I can't tell you how many days before figuring out the source of thie issue have been spent on this!!! Thanks for your help. BTW: version 2814:3539. I adownloaded and installed 2916:3554 (v10.5.6). Manifests there too.
    Last edited by Mike Wilson; 06-05-2010, 01:13 PM.
    Mike W
    __________________________
    "I rebel in at least small things to express to the world that I have not completely surrendered"

    #2
    Re: BUG: Custom toolbar makes error in report save

    following your instructions, xppro machine, release cand 6, all works as advertised
    Cole Custom Programming - Terrell, Texas
    972 524 8714
    [email protected]

    ____________________
    "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

    Comment


      #3
      Re: BUG: Custom toolbar makes error in report save

      I've got it erroring on 3 different machines.
      Mike W
      __________________________
      "I rebel in at least small things to express to the world that I have not completely surrendered"

      Comment


        #4
        Re: BUG: Custom toolbar makes error in report save

        what is the error?
        Cole Custom Programming - Terrell, Texas
        972 524 8714
        [email protected]

        ____________________
        "A young man who is not liberal has no heart, but an old man who is not conservative has no mind." GB Shaw

        Comment


          #5
          Re: BUG: Custom toolbar makes error in report save

          I see the errors.
          Looks like a bug, but it is not.
          Fixed.
          No more errors.

          Comment


            #6
            Re: BUG: Custom toolbar makes error in report save

            Thank you very much, Gabriel!
            I won't even attempt to figure out why it worked with a system toolbar and why it didn't work with custom toolbar.

            Martin,
            FYI, the error message is attached.
            Mike W
            __________________________
            "I rebel in at least small things to express to the world that I have not completely surrendered"

            Comment


              #7
              Re: BUG: Custom toolbar makes error in report save

              Originally posted by Mike Wilson View Post
              I won't even attempt to figure out why it worked with a system toolbar and why it didn't work with custom toolbar.
              Actually, with the system toolbar, it didn't work but it didn't produce the error either. I won't attempt to figure out why either because the only way to figure it out is if I knew the code behind saveas(), and I don't.

              Comment


                #8
                Re: BUG: Custom toolbar makes error in report save

                Hi Mike,

                Originally posted by Mike Wilson View Post
                I won't even attempt to figure out why it worked with a system toolbar and why it didn't work with custom toolbar.
                The reason (with about a 98% Correction: I'll make that 100% certainty) is that you are using variables that Alpha uses in the report.saveas() method. There is no reason to. Eg. your code is
                query.filter = "Agent_pqid = "+quote(vagentpqid)+ " .and. isblank(\"Date_done\")"
                query.order = "Last_name"
                'replace variables in the filter with their actual values
                query.filter = convert_expression(query.filter,"V")

                :Report.Preview("Agent Statuses",query.filter,query.order)
                ' ....Other code of yours
                :Report.SaveAs("Agent Statuses","PDF",query.filter,query.order,voutfile ,.F.)
                The values in red are not what you originally set. Changing it to something like
                dim myfilter as c
                dim myorder as c
                myfilter = "Agent_pqid = "+quote(vagentpqid)+ " .and. isblank(\"Date_done\")"
                myorder = "Last_name"
                'replace variables in the filter with their actual values
                myfilter = convert_expression(myfilter,"V")

                :Report.Preview("Agent Statuses",myfilter,myorder)
                ' ....Other code of yours
                :Report.SaveAs("Agent Statuses","PDF",myfilter,myorder,voutfile ,.F.)
                will make the error go away. What is happening? "query" is a global pointer variable that alpha uses for queries. If you happen to set the properties (Order and filter) of the pointer and run a query, you are fine.

                However, you are passing these values of properties to report.Preview() method. This is still fine, as the values are correct before using the method and are passed to the method as values. However, because you set a custom toolbar for the report, it now needs to find the toolbar in the database's al* files. (which is just a DBF table renamed, where it is stored). To do this, Alpha Five runs a query for the location of the toolbar in this renamed table, and guess what? It changes the property values of the global pointer "query" to what it needs. (Had you used the "System toolbar", no query by Alpha is required, and the query pointer properties would not have changed.)

                Now the filter is no longer what you require, and now you are passing the changed values to the Report.saveas() method.

                Oops. It didn't work!
                That's because the global filter properties have changed after the preview method.

                I'll add an addition to my tips on variable usage, which is don't count on Alpha Five maintaining it's "system-defined" global variables beyond the next call that might use them. This is why I stress constantly that you use local variables where ever possible and DIM all of them!

                Added: Is it a bug in Alpha? Not really. You were using a system defined global variable, and expecting it to be preserved, which Alpha does not guarantee. In fact, it's possible for 2 different forms (or threads/sessions) both running code to step on each other's usage of this global pointer variable. While this is not typical for most Alpha users, it can be done if you switch forms while a long operation is happening that uses it.

                Should the values be preserved? I recommend that all functions and methods be written as close to what's referred to as a "pure" function as possible. Realistically (and in cases similar to this, historically going back to A5v1), it can't always be done without making a lot of other historical code (user's and Alpha's) fail. Alpha can change this one to work, but not all cases you might run into.

                It is better to control your own destiny and fix your code.
                Last edited by csda1; 06-05-2010, 07:53 PM.
                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


                  #9
                  Re: BUG: Custom toolbar makes error in report save

                  The custom toolbar is used with the form, not the report.

                  query.filter & query.order have nothing to do with the error produced.

                  The error is produced as alpha is attempting to parse the name of the file to save.

                  Comment


                    #10
                    Re: BUG: Custom toolbar makes error in report save

                    Originally posted by G Gabriel View Post
                    The custom toolbar is used with the form, not the report.

                    Yes, you are correct the custom toolbar is on the form, but the problem and solution still holds.

                    The form creates a session (also called shared) pointer variable called query with the same properties that has the value of the last thing queried, which is the custom toolbar (which is the error message being shown). This is also version/release dependent, depending upon whether the custom toolbar is refetched at various points (which Alpha has played with) The last value of the session variable pointer query is
                    ?ptr.query
                    = filter = name = 'custom form' .and. left(type,4) = "TLBR"
                    order = ""
                    The button that runs the report.preview() and the report.saveas() invokes the function agent_status_send() in the current form's session.

                    That code has no locally defined pointer called query. Hence it uses the next higher scoped value it finds, which in this case is session/shared variable pointer query (as opposed to global).

                    Depending upon when and if the custom toolbar is refetched, the values to query.filter and query.order that the code changed, would be overwritten by the refetch of the custom toolbar.

                    Had the query pointer been DIM'd locally, the error would not have occured. Nevertheless, using any system defined variables was not needed for these calls to report.preview() and report.saveas() and by implicit DIM'ing, rather than an explicit local DIM variable, gave rise to the problem
                    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


                      #11
                      Re: BUG: Custom toolbar makes error in report save

                      1-Mike assigns new values to query filter/order right before saving the report. Any previous values do not count.
                      2-Run the script from the code tab, it works fine.
                      Last edited by G Gabriel; 06-05-2010, 09:36 PM.

                      Comment

                      Working...
                      X