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

Advanced Button dialog error

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

    Advanced Button dialog error

    I have a dialog with an advanced button named vR1 with the following code in the button's Server OnClick event:
    Code:
    vFilename = ""
    vOrder = ""
    vFilter = ""
    Dim Global vLabel as C = "R01" 
    Dim vFilename as c
    vFilename = session.session_folder + chr(92) + "Avery5160.pdf"
    vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.)
    if file.exists(vFilename )
            response.redirect(session.session_url + "Avery5160.pdf?" + time("hms3"))
    end if
    This code works correctly and prints the report.

    BUT, when I wrap the code in a function in the dialog's Server Declarations event:
    Code:
    FUNCTION PrintAvery5160 AS V (vLabelx as C)
    vFilename = ""
    vOrder = ""
    vFilter = ""
    Dim Global vLabel as C = vLabelx
    Dim vFilename as c
    vFilename = session.session_folder + chr(92) + "Avery5160.pdf"
    vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.)
    if file.exists(vFilename )
            response.redirect(session.session_url + "Avery5160.pdf?" + time("hms3"))
    end if
    END FUNCTION
    And put this code in the button's Server OnClick event:

    PrintAvery5160("R01")

    I get an error message stating:

    "Error in event handler code for OnClick event for 'vR1': Not found
    session not found."

    Apparently the OnClick doesn't recognize the
    session.session_folder variable in the function.

    ???
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com



    #2
    Re: Advanced Button dialog error

    Does anyone have any insight into this?
    Peter
    AlphaBase Solutions, LLC

    [email protected]
    https://www.alphabasesolutions.com


    Comment


      #3
      Re: Advanced Button dialog error

      Peter,

      I still haven't ventured into the web end of the Alpha pool (soon though) so I can't offer an explanation but may this would work as a workaround.

      Code:
      FUNCTION PrintAvery5160 AS V (vLabelx as C,sessfolder as C)
      vFilename = ""
      vOrder = ""
      vFilter = ""
      Dim Global vLabel as C = vLabelx
      Dim vFilename as c
      vFilename = sessfolder + chr(92) + "Avery5160.pdf"
      vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.)
      if file.exists(vFilename )
              response.redirect(session.session_url + "Avery5160.pdf?" + time("hms3"))
      end if
      END FUNCTION
      and then

      PrintAvery5160("R01",session.session_folder)
      Tim Kiebert
      Eagle Creek Citrus
      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

      Comment


        #4
        Re: Advanced Button dialog error

        Peter,

        I was under the assumption that we needed to have 2 _ _ for security reasons maybe that is a problem try

        vFilename = session.session__folder + chr(92) + "Avery5160.pdf"
        2_ _

        Nicholas
        Nicholas Wieland
        LedgerSuite.com Corp
        [email protected]
        http://www.ledgersuite.com

        Comment


          #5
          Re: Advanced Button dialog error

          Peter I have been thinking about this all day,
          and it doesn't make sense that it doesn't work.
          I regularly ''Functionalise'' sfuff for OO efficiencies the way you did, but so far have stayed out of the 'Server Declarations event' area.
          So just looking at your code I'm surprised it doesn't work.
          -Long shot, is there a security issue somewhere here?
          As the Alpha security doesn't appear to protect, rather blinds and hides.

          Comment


            #6
            Re: Advanced Button dialog error

            Tim:
            Tried your idea, but she won't go. Same error message.

            Nicholas:
            Security has not been enabled. And the code works, minus the function when I put it directly in the button's OnClick event. Trouble is, I will have 30 buttons, and I don't want to dup the code 30X only to have to change it down the road.

            Colin:
            Again, no security at all (yet).
            It might well be a bug.

            Thanks gentlemen. Appreciate you weighing in.
            Last edited by Peter.Greulich; 06-20-2009, 04:54 PM. Reason: correcto
            Peter
            AlphaBase Solutions, LLC

            [email protected]
            https://www.alphabasesolutions.com


            Comment


              #7
              Re: Advanced Button dialog error

              This is not a bug. The system variable "session" is not passed to the contents of the function.
              Code:
              FUNCTION PrintAvery5160 AS V (vLabelx as C)
              Therefore any reference to "session" inside the function will give an error message indicating "session" is not found.

              Comment


                #8
                Re: Advanced Button dialog error

                Originally posted by JerryBrightbill View Post
                This is not a bug. The system variable "session" is not passed to the contents of the function.
                Code:
                FUNCTION PrintAvery5160 AS V (vLabelx as C)
                Therefore any reference to "session" inside the function will give an error message indicating "session" is not found.
                Ok, thanks Jerry.

                Is there any way around this conundrum?
                Peter
                AlphaBase Solutions, LLC

                [email protected]
                https://www.alphabasesolutions.com


                Comment


                  #9
                  Re: Advanced Button dialog error

                  Ok, success. Tim got me to thinking. Here is the slightly ugly work around. But, at least I can isolate the guts of it for easy future modification.

                  Functions in the dialog's Server Declarations event:
                  Code:
                  FUNCTION func1 as C (vLabelx as C)
                      Dim Global vPrintType as C = "work"
                      Dim Global vLabel as C = vLabelx
                      
                      Dim shared vOrder as C
                      Dim shared vFilter as C
                  
                      vOrder = ""
                      vFilter = ""
                      
                      func1 = "Avery5160.pdf"        ''the output name
                  END FUNCTION
                  
                  FUNCTION func2 as L (vFilename as C)
                      Dim shared vOrder as C
                      Dim shared vFilter as C
                      vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.)
                      
                      func2  = file.exists(vFilename)
                  END FUNCTION
                  Not that func1() will have over 20 variable assignments added to it before I'm done.

                  Here is the code for the button's Server OnClick event (in this case for button R01):
                  Code:
                  vOutputName = func1("R01")
                  
                  vFilename = session.session_folder + chr(92) + vOutputName
                  
                  IF func2(vFilename) = .T.
                      response.redirect(session.session_url + vOutputName + "?" + time("hms3"))
                  END IF
                  There will be 30 buttons all told. So this, at least, allows me to maintain a degree of flexibility w/o reinventing the wheel.

                  Thanks all.
                  Last edited by Peter.Greulich; 06-20-2009, 06:20 PM.
                  Peter
                  AlphaBase Solutions, LLC

                  [email protected]
                  https://www.alphabasesolutions.com


                  Comment


                    #10
                    Re: Advanced Button dialog error

                    Peter,

                    Have you tried Jerry's suggestion:

                    FUNCTION PrintAvery5160 AS V (vLabelx as C,session as P)
                    .
                    .
                    .
                    Pat
                    Pat Bremkamp
                    MindKicks Consulting

                    Comment


                      #11
                      Re: Advanced Button dialog error

                      Peter,

                      EDIT: I did not see Pat's post while replying so I would definately try that first. Sounds to me like it should work. Although I don't see where in Jerry's post that is suggested.

                      Prompted by Jerry's reply I took another look at the code and see that there is still another reference to the session variable. ie session.session_url So that may be what is still triggering the error. I will have another try and then leave it up to the web experts. :)


                      Code:
                      FUNCTION PrintAvery5160 AS V (vLabelx as C,sessfolder as C,sessurl as C)
                          vFilename = ""
                          vOrder = ""
                          vFilter = ""
                          Dim Global vLabel as C = vLabelx
                          Dim vFilename as c
                          vFilename = sessfolder + chr(92) + "Avery5160.pdf"
                          vFilename = report.saveas("Avery5160@[PathAlias.ADB_Path]\AddressBook.DDD","pdf",vFilter,vOrder,vFilename,.f.)
                          if file.exists(vFilename )
                              response.redirect(sessurl + "Avery5160.pdf?" + time("hms3"))
                          end if
                      END FUNCTION
                      and then

                      PrintAvery5160("R01",session.session_folder,session.session_url)
                      Tim Kiebert
                      Eagle Creek Citrus
                      A complex system that does not work is invariably found to have evolved from a simpler system that worked just fine.

                      Comment


                        #12
                        Re: Advanced Button dialog error

                        Originally posted by Pat Bremkamp View Post
                        Have you tried Jerry's suggestion:

                        FUNCTION PrintAvery5160 AS V (vLabelx as C,session as P)
                        t
                        Hi Pat,

                        Yes, I did try that (actually Tim's suggestion). But it doesn't work. There does not seem to be anyway to pass the session variable pointer or it's subcomponents into a function.


                        Originally posted by Tim Kiebert View Post
                        Peter,
                        Prompted by Jerry's reply I took another look at the code and see that there is still another reference to the session variable. ie session.session_url

                        ...and then
                        PrintAvery5160("R01",session.session_folder,session.session_url)
                        No, I tried that as well and a bunch of other permutations. For whatever reason, you are not able to pass session and its subcomponents into a function. I even tried embedding the function directly into an a5w page and it still wouldn't work. But thanks.
                        Peter
                        AlphaBase Solutions, LLC

                        [email protected]
                        https://www.alphabasesolutions.com


                        Comment


                          #13
                          Re: Advanced Button dialog error

                          I'm learning a lot following this thread.
                          Question, Could a session cookie be used to resolve this?

                          Comment

                          Working...
                          X