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 email a report directly from grid

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

    #31
    Re: How to email a report directly from grid

    Just get rid of sessionfolder or whatever it's called <SessionFolder> I think? I had that problem too back when I upgraded to V12. I don't think it's related. If you are on V12.3 like me, then the problem is most likely the one I'm experiencing now. The answer may be in the new "Prototype Function" notes that show up when targeting Xbasic with a report...

    Code:
    function reportForEmail as c (e as p)
    'This function is called after the report has printed
    'The e object that is passed in includes:
    'e.tmpl - the component definition
    'e.dataSubmitted - data from the component
    'e.fileSessionKey - the key where the binary data for the report that was printed is stored in session storage.
    
    'The function can return Javascript to execute in the browser.
    
    'Using the e.fileSessionKey value you can retrieve the binary data for the report
    'For example
    'dim b as b 
    'session.GetDataFromFile(b,e.fileSessionKey)
    'dim size as n 
    'size = b.size()
    'if size = 0 then 
    '' ---- there must have been an error - no data was retrieved
    'end if 
    	
    	
    'Sample code to e-mail the report using the Mandril email service -----
    'dim key as c 
    'key = e.fileSessionKey
    'dim b as b 
    'get the binary day for the report
    'session.GetDataFromFile(b,key)
    'dim size as n 
    'size = b.size()
    'if size = 0 then 
    '	reportForEmail = "alert('Report was not sent.');"
    '	exit function
    'end if 
    'If you don't have a Mandrill secret key, sign up at Mandrill.com
    'dim mysecretkey as c = ""   'if you leave this blank the key value is read from a setting in Project Properties
    'dim ms as p
    'ms.send_to = "specify comma delimited list of email addresses"
    'ms.from_email = "your email address"
    'ms.subject = "put email subject here"
    'ms.message_html = "put email body here"
    'dim ms.attachmentsArray[1] as p
    'ms.attachmentsArray[1].name = "NameOfFile.pdf"   'if the report was an html report, use the .html extension
    'ms.attachmentsArray[1].type = resolve_mime_type("pdf") 'if the report was an html report, use the 'html'
    'ms.attachmentsArray[1].content = base64encode(b)
    'dim pResult as p
    'pResult = email_send_mandrill(mysecretkey,ms)
    'if pResult.error = .f. then 
    '	reportForEmail = "alert('Report sent.');"
    'else
    '	__name = "alert('Report was not sent.');"
    'end if 
    end function
    I think it may use some type of key now which is screwing things up.

    This is messing up my mojo right now too so I'm going to try to fix this ASAP

    Comment


      #32
      Re: How to email a report directly from grid

      I've submitted a bug report. Hopefully we can get this cleared up.

      Comment


        #33
        Re: How to email a report directly from grid

        OK,
        Evidently, the way I was doing it wasn't even supposed to work at all EVER. LOL. There's a "proper" way to do it that isn't really documented very well. The function prototype notes I posted above hint at it but don't actually tell you how to do it.

        So, you have to do something like this:
        Code:
        function reportForEmail as c (e as p)
        
        dim ajaxResponse as C
        dim reportName as C = e.reportFilename
        dim vjscmd as c
        dim key as c
        key = e.fileSessionKey
        dim b as b
        session.getDataFromFile(b,key)
        file.From_blob(reportName,b)
        	debug(1)              
                        session.fileName=e.reportFilename
                        ajaxResponse="{grid.object}.setValue('D','REPORTFILENAME','"+js_escape(session.fileName)+"');"
                        reportForEmail=ajaxResponse
                   
        end function
        Then you'll have to use the
        Code:
        file.remove(reportName)
        in another callback so your server doesn't fill with temp files.

        OR you can do it the Xbasic way which is the way I do it now normally (probably the way Ghandi is talking about.)

        But the Xbasic way will need to use the new methods as well if you are on V12.3. On 11 both my method and Ghandi's will work OK.

        Comment


          #34
          Re: How to email a report directly from grid

          Instead of using e.reportFilename Selwyn just informed me that you can do this instead:

          Code:
          dim reportName as c = request.GetRequestTempFileName("pdf")
          probably a better idea in case the e.reportFilename goes away as well.

          Comment


            #35
            Re: How to email a report directly from grid

            It would be really much more helpful if the box that says attachment...just allowed you to select a report or a file...from a genie.
            Speaking of genies I am glad Alpha decided to go with them. Wizards are used way too much and nobody would use a witch...a Warnock maybe
            NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

            Comment


              #36
              Re: How to email a report directly from grid

              Originally posted by CharlesParker View Post
              It would be really much more helpful if the box that says attachment...just allowed you to select a report or a file...from a genie.
              Speaking of genies I am glad Alpha decided to go with them. Wizards are used way too much and nobody would use a witch...a Warnock maybe
              A warlock you mean? Haha. Yup, but a wizard or warlock in his right mind would just frag you if you annoyed him. Genies HAVE to give you some wishes. Unfortunately, like Alpha's Genies, they can be pretty tricky with said wishes.

              Yeah, it sure would be a lot easier if you could automatically attach a report to an email.

              Comment


                #37
                Re: How to email a report directly from grid

                Yes "Warlock" unfortunately I use a program called auto-corrupt.
                NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                Comment


                  #38
                  Re: How to email a report directly from grid

                  Originally posted by CharlesParker View Post
                  Yes "Warlock" unfortunately I use a program called auto-corrupt.
                  My Note 4 wanted to type "Warnock" also.

                  Anyway, I had to redo all of my applications that email attached reports to use the new method I just described above. So it does work with the latest build of 12.3. I just had to spend all day messing around with it. Par for the course though. It seems every upgrade messes up something I did so I'm getting used to it. Not too surprising I guess, since parts of my code date back to version 10.

                  Comment


                    #39
                    Re: How to email a report directly from grid

                    So what method did you use? I mean did you use what you posted or the advice Selwyn gave? Do you still have to get rid of the temp files?
                    NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                    Comment


                      #40
                      Re: How to email a report directly from grid

                      Update: This is working for me FINALLY!!!
                      I did try to use
                      dim reportName as c = request.GetRequestTempFileName("pdf")
                      in place of
                      dim reportName as C = e.reportFilename

                      BUT that caused the attachment to fail. I am creating a lot of temporary files, that I would like to clean up/delete during this process.
                      just not 100% sure where to put the code snippet provided here.

                      On a somewhat unrelated note:
                      Out of curiosity I googled Warnock, it's an interesting topic, John Warnock was the founder of Adobe and then theres Bryan Warnock noted for
                      "Warnocks Dilemma" which is defined as,

                      “Warnock's Dilemma: The act of choosing whether the lack of response to a discussion-list post is because of its brilliance (there's nothing to add) or because of its stupidity (it doesn't deserve comment).”
                      NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                      Comment


                        #41
                        Re: How to email a report directly from grid

                        There's always a new issue right? This is not without issue as well. So the report is emailed however the PDF does not appear as does the html print out so the invoice number is cut off. It's almost as if the right margin is different. Might be a design of the report issue - but again the report is printing and this will open up new avenues for me of learning.

                        Thanks to Jinx and Ghandi (and of course Selwyn) for taking the time they did to help!
                        NWCOPRO: Nuisance Wildlife Control Software My Application: http://www.nwcopro.com "Without forgetting, we would have no memory at all...now what was I saying?"

                        Comment


                          #42
                          Re: How to email a report directly from grid

                          Update: This is working for me FINALLY!!!
                          very good.
                          thanks for reading

                          gandhi

                          version 11 3381 - 4096
                          mysql backend
                          http://www.alphawebprogramming.blogspot.com
                          [email protected]
                          Skype:[email protected]
                          1 914 924 5171

                          Comment


                            #43
                            Re: How to email a report directly from grid

                            Originally posted by GGandhi View Post
                            I did reply to your pm and showed how I do it.
                            have you had any chance to look at it?
                            Gandhi, would you be kind enough to share your method? Thank you.

                            Comment


                              #44
                              Re: How to email a report directly from grid

                              Originally posted by GGandhi View Post
                              I did reply to your pm and showed how I do it.
                              have you had any chance to look at it?
                              Gandhi, would you be kind enough to share your method? Thank you.

                              Comment


                                #45
                                Re: How to email a report directly from grid

                                are you trying to send a report as pdf via email?
                                thanks for reading

                                gandhi

                                version 11 3381 - 4096
                                mysql backend
                                http://www.alphawebprogramming.blogspot.com
                                [email protected]
                                Skype:[email protected]
                                1 914 924 5171

                                Comment

                                Working...
                                X