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

Email current report as an email

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

    Email current report as an email

    Alpha has a really neat built in utility for emailing a report. When viewing a report, there is a toolbar option: Send report via e-mail as an Acrobat.PDF Attachment. This is a nice one step, quick way to email a report.

    As neat as this feature is, I don't have very much control. I would like to be able to rename the PDF file. Alpha just takes the name of the report that is being viewed. Sometimes, the report name is not that appropriate. Also, where does Alpha store the PDF that is created?

    I would like a simple xDialog that would allow me to:
    1. input the PDF name
    2. store the PDF on the Desktop
    3. open my email with the attachment.

    I have done this.

    Code:
    dim MyPDFName as C
    dim CurReport as C
    dim LoggedInUser as C = api_getusername()	'computer log in
    dim PDFOnDesktop as C
    
    'enter name for new PDF file
    DIM SHARED vcName as C
    DIM XDialogStyle as P
    XDialogStyle.AccentColor = "Off White"
    XDialogStyle.Color = "Blue White"
    DIM SHARED varC_result as C
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("E-mail a PDF Attachment",<<%dlg%
    {units=F}{font=Calibri,12}{xmargin=4,4}{ysize=.3}
    {Windowstyle=Gradient Horizontal};;
    
    {region}
    Enter a Name for the PDF Attachment;;
    [.30MyPDFName];;
    {endregion};
    
    {line=1,0};;
    
    {region}
    {justify=center,Center}
    <10,1.5=ok_button_label!OK?mypdfname<\>""> <*10,1.5=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    %code%)
    
    if varC_result <> "OK" then
    	end
    end if
    
    ''windows 7 desktop
    PDFOnDesktop = "C:\Users\\"+loggedInUser+"\Desktop\\"+MyPDFName+".PDF"
    
    dim fn as C
    fn = report.saveas("_TestCust", "PDF", "", "", PDFOnDesktop)
    
    vcEmail_Addresses = ""
    subject_param = MyPDFName+" Report"
    message_param = ""
    Attachments = fn
    vcCC_Addresses = ""
    bcc_param = ""
    
    Email_Client_External(vcEmail_Addresses,subject_param,message_param,Attachments,vcCC_Addresses,bcc_param)
    What I can't figure out is how do I capture the currently viewed report and make it into a PDF.

    From what I could find, I have been using the function report.saveas() to generate the PDF. Going this route, it looks like I would have to re-run the report using the current report name, filter and order.

    This could be done using global variables I guess. Just wondering if someone may have an easier way.

    Thanks,

    Ron
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    #2
    Re: Email current report as an email

    I did go with the global variable route and this does work very well.
    On my test report, I did have to refine the filter replacing references to variables to wrapping the variable in s_quote().
    The down side is that I have almost 100 reports with many more filtering options. If I wish to apply this feature to every report, this would be a major undertaking.

    Code:
    dim MyPDFName as C
    dim CurReport as C
    dim LoggedInUser as C = api_getusername()	'computer log in
    dim PDFOnDesktop as C
    
    'enter name for new PDF file
    DIM SHARED vcName as C
    DIM XDialogStyle as P
    XDialogStyle.AccentColor = "Off White"
    XDialogStyle.Color = "Blue White"
    DIM SHARED varC_result as C
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    varC_result = ui_dlg_box("E-mail a PDF Attachment",<<%dlg%
    {units=F}{font=Calibri,12}{xmargin=4,4}{ysize=.3}
    {Windowstyle=Gradient Horizontal};;
    
    {region}
    Enter a Name for the PDF Attachment;;
    [.30MyPDFName];;
    {endregion};
    
    {line=1,0};;
    
    {region}
    {justify=center,Center}
    <10,1.5=ok_button_label!OK?mypdfname<\>""> <*10,1.5=cancel_button_label!CANCEL>
    {endregion};
    %dlg%,<<%code%
    %code%)
    
    if varC_result <> "OK" then
    	end
    end if
    
    ''windows 7 desktop
    PDFOnDesktop = "C:\Users\\"+loggedInUser+"\Desktop\\"+MyPDFName+".PDF"
    
    ''use global variables which are set in the code to run the report
    dim fn as C
    fn = report.saveas(var->email_Rpt, "PDF", var->email_Filter, var->email_order, PDFOnDesktop)
    
    vcEmail_Addresses = ""
    subject_param = MyPDFName+" Report"
    message_param = ""
    Attachments = fn
    vcCC_Addresses = ""
    bcc_param = ""
    
    Email_Client_External(vcEmail_Addresses,subject_param,message_param,Attachments,vcCC_Addresses,bcc_param)
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    Comment


      #3
      Re: Email current report as an email

      can't you just make these functions and simply call the function on click?
      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


        #4
        Re: Email current report as an email

        I can make the scripts functions, but that will not solve the issue. The way I see it, I have to capture the name of the report, the filter and order when I run the report. While viewing the report, if I opt to email that report as a PDF, I then need to run the report.saveas function using the globally stored values. It works just fine. In reality, I probably will only use this on selected reports.

        I was just wondering if anyone else had an easier way of doing this.
        Alpha 5 Version 11
        AA Build 2999, Build 4269, Current Build
        DBF's and MySql
        Desktop, Web on the Desktop and WEB

        Ron Anusiewicz

        Comment


          #5
          Re: Email current report as an email

          The "neat function while viewing a report" is not quite that !!!

          Therein lies the problem.
          Make your own - a little effort to start but easier in the long run.
          feed it your PDF file name and choose what you want it to do.

          Comment


            #6
            Re: Email current report as an email

            Ron,

            Are you looking for this?

            Code:
            'What I can't figure out is how do I capture the currently viewed report and make it into a PDF.
            
            ' 1 ; select a report and print with pdf
            ' 2 ; select the attachment
            
            vReportList=<<%vReport%
            customer List
            Other List
            sample 1
            %vReport%
            
            	dim vFileName as c =""
            	dim vPdffile as c =""
            	
            
            ui_dlg_box("Print",<<%dlg%
            show the report;
            Report:;
            [.50,5vSelectReport^#vReportList];
            <Print> <cancel>
            %dlg%,<<%code%
            If a_dlg_button = "print" then
            	'print it with PDf
            	'save to where and name
            
            	vFileName = "test_list.pdf"
            	vSavePath ="C:\Users\Koh\Documents\My Temporary"
            	
            	vPdffile = report.saveas(alltrim(vSelectReport), "PDF", "", "",vSavePath+chr(92)+vFileName)
            	
            	'Build the Error Check at here
            	
            	If file.exists(vPdffile) then
            		Sub_control(vPdffile)
            	else
            		msgbox("not completed the PDF print ")
            		cancel()	
            	end if
            else
            	'just close it
            	
            end if
            %code%)
            
            
            function Sub_control as c (vPdffile)
            dim MyPDFName as C
            dim CurReport as C
            dim LoggedInUser as C = api_getusername()	'computer log in
            dim PDFOnDesktop as C
            
            'enter name for new PDF file
            DIM SHARED vcName as C
            DIM XDialogStyle as P
            XDialogStyle.AccentColor = "Off White"
            XDialogStyle.Color = "Blue White"
            DIM SHARED varC_result as C
            ok_button_label = "&OK"
            cancel_button_label = "&Cancel"
            varC_result = ui_dlg_box("E-mail a PDF Attachment",<<%dlg%
            {units=F}{font=Calibri,12}{xmargin=4,4}{ysize=.3}
            {Windowstyle=Gradient Horizontal};;
            
            {region}
            Enter a Name for the PDF Attachment;;
            [.30MyPDFName];;
            {endregion};
            
            
            The next smart fields are "user defined" smart fields.;
            {region=a}
            Get Current PDF with path:| [.50vPdffile];;
            or just show the file name and....:;
            | [.50vTrimedPdffile];;
            
            or select one;
            Filename:| [%fText files(*.txt)|Doc files(*.doc)|PDF files(*.pdf)%.52filename];
            
            {lf=2};
            Alpha sample;
            Email_A5: | [%p=popup.email_a5(email);i=popup.email%.50email] \(using Alpha Five mail client);
            
            Email: | [%p=popup.email(email);i=popup.email%.50email] \(using default mail client);
            
            {endregion};
            
            
            {line=1,0};;
            
            {region}
            {justify=center,Center}
            <10,1.5=ok_button_label!OK?mypdfname<\>""> <*10,1.5=cancel_button_label!CANCEL>
            {endregion};
            %dlg%,<<%code%
            %code%)
            if varC_result <> "OK" then
            	end
            end if
            
            ''windows 7 desktop
            PDFOnDesktop = "C:\Users\\"+loggedInUser+"\Desktop\\"+MyPDFName+".PDF"
            
            ''use global variables which are set in the code to run the report
            dim fn as C
            fn = report.saveas(var->email_Rpt, "PDF", var->email_Filter, var->email_order, PDFOnDesktop)
            
            vcEmail_Addresses = ""
            subject_param = MyPDFName+" Report"
            message_param = ""
            Attachments = fn
            vcCC_Addresses = ""
            bcc_param = ""
            
            Email_Client_External(vcEmail_Addresses,subject_param,message_param,Attachments,vcCC_Addresses,bcc_param)
            
            end function

            Comment


              #7
              Re: Email current report as an email

              By Make Your Own I would look at doing it this way without requiring much dlg coding
              1. Make a new form myreportform. On this place a report preview supercontrol. Add the buttons for whatever options you wish to access.
              2. open this form as dialog ...
              Code:
              dlgPreview_result = form.dialog("myreportform","",filterstring,"","","Fill","Fill")
              where you replace filterstring of course, you can use a shared variable
              Once it has been open you are at the stage of viewing your report but with your buttons under your control.
              if you close the reportview after depressing one of your buttons you can read the button pushed but you may not need to do anything with that. If you have a button "SEND email" use the OnPush of the button to perform the save and send. Set shared vars for filename and send to etc. prior to step 2.
              A button on the form to save and send pdf email would run something like
              Code:
              Report.Saveas("myreportform","PDF",filterstring,"",vi_pdn)	'save the pdf with path/name saved in vi_pdn, the same filter
              dim global snd as p
              snd.from= Return email address
              snd.date=""
              snd.failure=""
              snd.success=""
              snd.from_Alias=
              snd.to = 
              snd.subject =
              snd.attachments =vi_pdn 'HERE IS YOUR PDF
              snd.html_message = <<%html%
              <html>
              Please open the attached document.</p>
              </p>
              </p>Thank you
              </html>
              %html%
              email_send2(snd)
              Does as you ask
              codicil = I roughly converted from something that sends invoices in one of my apps, changed on the fly - needs testing to see if the names used will apply. In principle the method works.
              Last edited by Ray in Capetown; 06-15-2015, 02:48 PM. Reason: added line snd.html_message = <<%html% // %html%

              Comment


                #8
                Re: Email current report as an email

                Ray,

                I tried your code and go the message, "Cjould not connect to SMTP server:" Using windows Live Mail on windows 7 machine.

                Ideas?

                TIA - Tom

                Comment


                  #9
                  Re: Email current report as an email

                  I used Alpha's mail in that example.
                  Not external mail software

                  The point here was to be able to save the report pdf whilst viewing, with a selected name rather than the report name, be able to email it.
                  All that was really needed was the dialog style form in the first part and
                  Code:
                  Report.Saveas("myreportform","PDF",filterstring,"",vi_pdn)	'save the pdf with path/name saved in vi_pdn, the same filter
                  the rest is superfluous based on how you choose to email it.
                  I would choose not to make the user do anything except view it and have the option (and anything else one would like to do with the PDF) to add whatever heading, title, body text and the attachment goes with ....

                  Comment


                    #10
                    Re: Email current report as an email

                    I also must admit that I expect Robert was not asking for finished working code as he is quite capable I think, just an idea to circumvent the problem, not with the emailing part - that was just a rough example of one possible way to approach the emailing.
                    and thanks for your interest BTW - luckily I didn't spend a heck of a lot of more time testing and bomb proofing.
                    But great that you got as far as achieving the main principle.
                    Last edited by Ray in Capetown; 06-18-2015, 04:48 PM.

                    Comment


                      #11
                      Re: Email current report as an email

                      I've been away on vacation so I haven't had any time to respond. Ray, your method is interesting. For now, I'm going to stick with what I have. It's only for one report. If it's decided to add this feature to more reports, I'll deal with it then.

                      Thanks
                      Alpha 5 Version 11
                      AA Build 2999, Build 4269, Current Build
                      DBF's and MySql
                      Desktop, Web on the Desktop and WEB

                      Ron Anusiewicz

                      Comment


                        #12
                        Re: Email current report as an email

                        Ron,
                        You will get there as you are going, but lots of work.
                        I learned a long time ago to print to and email app like "Lightning Pdf" or "PDF Factory" (you can then view easily and save to any name) then attach it to an email.
                        Dave Mason
                        [email protected]
                        Skype is dave.mason46

                        Comment


                          #13
                          Re: Email current report as an email

                          Hi Dave,
                          I see NCH software also offers a print driver called BOLT for $19.99 (also free but with watermark) but was not offering the free Lightning PDF except from download.cnet.com
                          Robin

                          Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

                          Comment


                            #14
                            Re: Email current report as an email

                            I paid for Lightning pdf. I think Borland?? I will check it for you. It came from avanquest and I got the professional version
                            http://www.avanquest.com/USA/search....=lightning+pdf

                            pdf factory has a free version at:
                            http://shop.software-partners.co.uk/...intpdffactory/ I have the pro
                            Last edited by DaveM; 06-28-2015, 05:51 PM.
                            Dave Mason
                            [email protected]
                            Skype is dave.mason46

                            Comment


                              #15
                              Re: Email current report as an email

                              We do a LOT of "save as" with PDF files. we then e-mail them using SMTP e-mail which, to us, seems much more reliable than email_send.

                              This is the SMTP e-mail routine. As long as your ISP has SMTP set up, then it is very easy to accomplish. All you need is an ID and Password.

                              Code:
                              DIM mail_from as C = [COLOR="#FF0000"]xxxxxxx[/COLOR]     'valid e-mail address
                              DIM mail_to  as C = [COLOR="#FF0000"]yyyyyy[/COLOR]     'valid e-mail address
                              DIM ps as P
                              DIM pm as P
                              msg_text = "Whatever you need to put here"
                              pm.from = mail_from
                              pm.from_alias = "Some descriptive name"
                              pm.to = mail_to
                              pm.subject = "Some descriptive Text"
                              pm.cc = ""
                              pm.bcc = ""
                              pm.message = msg_text
                              if email_smtp_open(ps,[COLOR="#FF0000"]'address of ISP,25,[/COLOR][COLOR="#800080"]'sender's e-mail address[/COLOR],[COLOR="#800080"]'sender's e-mail password[/COLOR])
                              	email_smtp_send(pm,ps)
                              	email_smtp_close(ps)
                                else
                                	ui_msg_box("ERROR","Problem! - There is a Problem with the SMTP Email"+crlf()+"No e-mail was sent to "+mail_to)
                              end if
                              Tom

                              Comment

                              Working...
                              X